Retrieving column values

To enable the built-in iterative search capability for SmartList, each column value must be supplied as a string. This will be required if you choose not to use SQL-optimized searching. The Explorer_Get_Field_As_String_From_Table procedure will be called by SmartList to retrieve the string values for the columns that are being searched. This procedure must have the following parameters:

inout string IO_String;
in integer IN_Object_Dict_ID;
in integer IN_Object_Type;
in integer IN_Field_Dict_ID;
in integer IN_Field_ID;
in boolean IN_Searching;
in string IN_Master_ID;
inout integer IO_Datatype;
inout long IO_Long;
inout date IO_Date;
inout currency IO_Currency;
inout time IO_Time;

If you were integrating with an existing SmartList object, you would use the IN_Master_ID parameter which would contain the key information needed to retrieve the record with fields to display. Because this is a new SmartList object, this parameter will not be set. Instead, a global variable named SmartList_Master_ID is used to pass the key information into this procedure. You must add this global variable to your integrating application. It has the following characteristics:

Global variable name: SmartList_Master_ID

Global field name: SmartList_Master_ID

Datatype name: SmartList_Master_ID

Control type: String

Keyable length: Typically 30

 

The keyable length for this global variable must be long enough to support the longest key values you will pass to the procedure to retrieve each row of data for your SmartList object.

After your code has used the key information from the SmartList_Master_ID global variable to retrieve the appropriate record from your table, it must set the inout parameters for the column you added. The value of the IO_String parameter must be set to the string value you want to be searchable by the SmartList. If necessary, you can apply formatting to this string. For instance, you could use the format() function to apply formatting to a currency value.

Your code must set the IO_Datatype parameter, which specifies the underlying datatype for the column. Then it must set the value of the corresponding parameter for the datatype. For example, if the column displays a currency value, you will set the IO_Datatype parameter to SMARTLIST_DATATYPE_CURRENCY and set the IO_Currency parameter to the actual currency value for the column.

The following is the Explorer_Get_Field_As_String_From_Table procedure from the sample integrating application. Based on the key value passed in through the IN_Master_ID parameter, it retrieves the appropriate record from the IG_Leads_MSTR table. It then sets the IO_String parameter and the appropriate datatype parameters.

Procedure name: Explorer_Get_Field_As_String_From_Table

 

inout string IO_String;
in integer IN_Object_Dict_ID;
in integer IN_Object_Type;
in integer IN_Field_Dict_ID;
in integer IN_Field_ID;
in boolean IN_Searching;
in string IN_Master_ID;

inout integer IO_Datatype;
inout long IO_Long;
inout date IO_Date;
inout currency IO_Currency;
inout time IO_Time;

{Handle columns for new SmartList objects that are not SQL-optimized}
if IN_Object_Dict_ID = IG_PROD_ID then
	if IN_Object_Type = SMARTLIST_OBJECTTYPE_LEADS then
		{Read the record for the row being populated}
		'Lead ID' of table IG_Leads_MSTR = SmartList_Master_ID of globals;
		get table IG_Leads_MSTR;
		if err() = OKAY then
			case IN_Field_ID
			in [resourceid(field 'Lead ID')]
				IO_Datatype = SMARTLIST_DATATYPE_STRING;
				IO_String = 'Lead ID' of table IG_Leads_MSTR;
			in [resourceid(field 'Lead Name')]
				IO_Datatype = SMARTLIST_DATATYPE_STRING;
				IO_String = 'Lead Name' of table IG_Leads_MSTR;
			in [resourceid(field 'Lead Business Category')]
				{Need a "helper" window field to get the category name}
				'Lead Business Category' of window Dummy of form Command_IG_Sample = 'Lead Business Category' of table IG_Leads_MSTR;
				IO_String = itemname('Lead Business Category' of window Dummy of form Command_IG_Sample, 'Lead Business Category' of table IG_Leads_MSTR);
				IO_Long = 'Lead Business Category' of table IG_Leads_MSTR;
				IO_Datatype = SMARTLIST_DATATYPE_DDL;
			in [resourceid(field 'Potential Revenue')]
				IO_String = format('Potential Revenue' of table IG_Leads_MSTR, true, true, 2, SYSTEMNEG);
				IO_Currency = 'Potential Revenue' of table IG_Leads_MSTR;
				IO_Datatype = SMARTLIST_DATATYPE_CURRENCY;
			in [resourceid(field 'Contact')]
				IO_String = 'Contact' of table IG_Leads_MSTR;
				IO_Datatype = SMARTLIST_DATATYPE_STRING;
			in [resourceid(field 'Address 1')]
				IO_String = 'Address 1' of table IG_Leads_MSTR;
				IO_Datatype = SMARTLIST_DATATYPE_STRING;
			in [resourceid(field 'Address 2')]
				IO_String = 'Address 2' of table IG_Leads_MSTR;
				IO_Datatype = SMARTLIST_DATATYPE_STRING;
			in [resourceid(field 'City')]
				IO_String = 'City' of table IG_Leads_MSTR;
				IO_Datatype = SMARTLIST_DATATYPE_STRING;
			in [resourceid(field 'State')]
				IO_String = 'State' of table IG_Leads_MSTR;
				IO_Datatype = SMARTLIST_DATATYPE_STRING;
			in [resourceid(field 'Zip')]
				IO_String = 'Zip' of table IG_Leads_MSTR;
				IO_Datatype = SMARTLIST_DATATYPE_STRING;
			in [resourceid(field 'Phone 1')]
				IO_String = 'Phone 1' of table IG_Leads_MSTR;
				IO_Datatype = SMARTLIST_DATATYPE_PHONENUMBER;
			in [resourceid(field 'Phone 2')]
				IO_String = 'Phone 2' of table IG_Leads_MSTR;
				IO_Datatype = SMARTLIST_DATATYPE_PHONENUMBER;
			in [resourceid(field 'Fax')]
				IO_String = 'Fax' of table IG_Leads_MSTR;
				IO_Datatype = SMARTLIST_DATATYPE_PHONENUMBER;
			in [resourceid(field 'Salesperson ID')]
				IO_String = 'Salesperson ID' of table IG_Leads_MSTR;
				IO_Datatype = SMARTLIST_DATATYPE_STRING;
			in [resourceid(field 'Qualified Lead')]
				{Need a "helper" window field to get the qualification status}
				'Qualified Lead' of window Dummy of form Command_IG_Sample = 'Qualified Lead' of table IG_Leads_MSTR;
				IO_String = itemname('Qualified Lead' of window Dummy of form Command_IG_Sample, 'Qualified Lead' of table IG_Leads_MSTR);
				IO_Long = 'Qualified Lead' of table IG_Leads_MSTR;
				IO_Datatype = SMARTLIST_DATATYPE_DDL;
			in [resourceid(field 'Qualification Date')]
				IO_String = str('Qualification Date' of table IG_Leads_MSTR);
				IO_Date = 'Qualification Date' of table IG_Leads_MSTR;
				IO_Datatype = SMARTLIST_DATATYPE_DATE;
			in [resourceid(field 'Lead Source')]
				IO_String = 'Lead Source' of table IG_Leads_MSTR;
				IO_Datatype = SMARTLIST_DATATYPE_STRING;
			end case;
		end if;
	end if;
end if;


Documentation Feedback