Examples: Columns_AddToken()


The following example is the GetColumnTokens procedure for a list. It shows how tokens would be added for a list column based on a the Typical Balance radio group. In this example, a search_condition expression is used to select the specific balance type. The physical name for the Typical Balance radio group is TPCLBLNC. The value 0 indicates a debit balance. The value 1 indicates a credit balance.

[spacer]

in ListObjState list_object;
in ColFieldID nFieldID;
in ColArrayIndex nArrayIndex;
in long nColumnID;

local long internal_ID;

if nFieldID = resourceid(field 'Typical Balance') then
	{Debit}
	internal_ID = Columns_AddToken(list_object, 
		nColumnID,
		"Debit", {Token name}
		1, {Unique ID for this token}
		"(TPCLBLNC = '0')") of form syListObj;

	{Credit}
	internal_ID = Columns_AddToken(list_object, 
		nColumnID,
		"Credit", {Token name}
		2, {Unique ID for this token}
		"(TPCLBLNC = '1')") of form syListObj;
end if;

The following example is the GetColumnTokens procedure for a list. It shows how tokens would be added for a list column based on the Document Type Name field, which is a string value stored in the table. The value can be “Work”, “Open”, or “History”. The token_name and qualifier parameters are used to define the selection criteria for each token. The physical name for this field is DOCTYNAM.

in ListObjState list_object;
in ColFieldID nFieldID;
in ColArrayIndex nArrayIndex;
in long nColumnID;

local long internal_ID;

if nFieldID = resourceid(field 'Document Type Name') then
	{Work}
	internal_ID = Columns_AddToken(list_object, 
		nColumnID,
		"Work", {Token name}
		1, {Unique ID for this token}
		"", {No expression}
		QUALIFY_SUFFIX) of form syListObj;

	{Open}
	internal_ID = Columns_AddToken(list_object, 
		nColumnID,
		"Open", {Token name}
		2, {Unique ID for this token}
		"", {No expression}
		QUALIFY_SUFFIX) of form syListObj;

	{History}
	internal_ID = Columns_AddToken(list_object, 
		nColumnID,
		"History", {Token name}
		3, {Unique ID for this token}
		"", {No expression}
		QUALIFY_SUFFIX) of form syListObj;

end if;

The three restriction expressions that will be generated for the tokens are:

(DOCTYNAM like 'Work%')

(DOCTYNAM like 'Open%')

(DOCTYNAM like 'History%')


Documentation Feedback