table column number

Prev Next

Function Names

table column number

Description

This function checks if a header with the specified header name is existing. If the header is found, then the column number will be returned. Otherwise, -1 is returned.

Call as: function

Restrictions

Indirect parameter passing is disabled

Parameter count

2

Parameters

No.TypeDescription
1
input
string Name of existing table

2
input
table column Header name or column number

See table columns as function parameters for general ruling for this parameter.
Specific rules apply for this function:

  • Only 1 header name or column number may be specified.

Return value

TypeDescription
numeral Column number

Note: 1st column begins with 0. -1 is returned if the column cannot be found.

Exceptions

Table not found

Examples

  table initialize ( table 1,
  { { Last Name, First Name, Phone No, Age }, { Larsson, Lara, "1-212-555-1212", 28 } } );

  echo( table column number ( table 1, Phone No ) );
  echo( table column number ( table 1, Gender ) ); // Returns -1

Output

2
-1
Try it yourself: Open LIB_Function_table_column_number.b4p in B4P_Examples.zip. Decompress before use.

See also

table check header