text_block_exists

The function text_block_exists tests if a Text Block exists in the KCM Designer and has a revision that can be used in a Master Template.

 text_block_exists (text_block;reserved)

The function text_block_exists is of type BOOL.

The function has two parameters:

  1. The parameter text_block is of type TEXT. This is the name of the Text Block which is searched for in KCM Designer.
  2. The parameter reserved is of type NUMBER. This parameter is reserved for future use and must always be set to 0.

The function text_block_exists returns TRUE if the Text Block exists in KCM Designer and has a suitable revision that can be used in a Master Template. The function returns FALSE if the Text Block does not exist or if there is no such revision.

The function text_block_exists only checks if a Text Block can be found in KCM Designer. It does not validate if Field Sets are available in the Master Template. The function get_fileds_from_text_block (see get_fields_from_text_block) can be used to query the Fields used in the Text Block to perform such validation in the Master Template.

An example is provided here.

TEXT block := "BuildingBlocks\" + Customer.Language + "\Salutation"
IF text_block_exists (block; 0) THEN
  TEXTBLOCK
      NAME block
ELSE
  TEXTBLOCK
      NAME "BuildingBlocks\ENG\Salutation"
FI

The preceding example shows how a Text Block 'Salutation' based on the language contained in the Customer.Language Field. If no Text Block is available for this language, it defaults to the language 'ENG'.