Starting the retrieve and display process

Retrieving and displaying records for a SmartList object requires multiple procedures to be called. Which procedures are called depend on the following factors:

The Explorer_Get_Records_Background procedure is called by SmartList to start the process of displaying records when no search criteria have been specified by the user. This procedure is also called when search criteria have been supplied, but SQL optimization has not been implemented for the SmartList object.

The following is the Explorer_Get_Records_Background procedure that is defined for the sample integrating application. It is called by the SmartList to begin adding records to the SmartList window.

Procedure name: Explorer_Get_Records_Background

 

in integer IN_Object_Dict_ID;
in integer IN_Object_Type;
in Explorer_INT_List IN_Field_Dict_ID;
in Explorer_INT_List IN_Field;
in Explorer_INT_List IN_Type;
in Explorer_STR30_List IN_Search_From;
in Explorer_STR30_List IN_Search_To;
in Explorer_BOOL_List IN_Match_Case;
in integer IN_Global_Search_Type;
in integer IN_Total_Sub_Items;
in Explorer_Resource_List IN_Dict_List;
in Explorer_Resource_List IN_Field_List;
in Explorer_Field_Comparison IN_Field_Comparison;
in Explorer_Start_Comp_Field_ID IN_Start_Comp_Field_ID;
in Explorer_Start_Comp_Field_Dict IN_Start_Comp_Field_Dict;
in Explorer_End_Comp_Field_ID IN_End_Comp_Field_ID;
in Explorer_End_Comp_Field_Dict IN_End_Comp_Field_Dict;
in Explorer_Start_Date_Token_DDL IN_Date_Token_From;
in Explorer_End_Date_Token_DDL IN_Date_Token_To;
inout long IO_Max_Records;

in boolean IN_GetSummary;
in integer IN_SummaryType; {0 = Number of records, 1 = Total of Column}
inout long IO_nSummaryCount;
in integer IN_nSummaryFieldDictID;
in integer IN_nSummaryFieldID;
inout currency IO_cyColumnTotal;

local integer i;
local Explorer_BOOL_List l_Searching;
local Explorer_INT_List l_Datatype;

if IN_Object_Dict_ID=IG_PROD_ID and IN_Object_Type=SMARTLIST_OBJECTTYPE_LEADS then
	{Fill the list of Leads}
	for i = 1 to 4 do
		if empty(IN_Field[i]) then
			set l_Searching[i] to false;
			clear l_Datatype[i];
		else
			set l_Searching[i] to true;
			call Explorer_Get_Datatype,
				l_Datatype[i],
				IN_Object_Dict_ID,
				IN_Object_Type,
				IN_Field_Dict_ID[i],
				IN_Field[i];
		end if;
	end for;

	call SmartList_GetLeadRecords,
		IN_Total_Sub_Items,
		l_Searching,
		IN_Dict_List,
		IN_Field_List,
		IN_Field_Dict_ID,
		IN_Field,
		l_Datatype,
		IN_Type,
		IN_Search_From,
		IN_Search_To,
		IN_Match_Case,
		IN_Global_Search_Type,
		IN_Field_Comparison,
		IN_Start_Comp_Field_ID,
		IN_Start_Comp_Field_Dict,
		IN_End_Comp_Field_ID,
		IN_End_Comp_Field_Dict,
		IO_Max_Records,
		IN_GetSummary, 
		IN_SummaryType, 
		IO_nSummaryCount,
		IN_nSummaryFieldDictID,
		IN_nSummaryFieldID,
		IO_cyColumnTotal;
				end if;

If SQL optimization has been implemented for the SmartList object and the user has specified search criteria, the Explorer_Process_SQL_Data procedure will be called instead. The SmartList will have generated a SQL results set that contains the key values of the records that match the search criteria. This results set is passed into the Explorer_Process_SQL_Data procedure, where the current row will be retrieved and displayed in the SmartList.

The following is the Explorer_Process_SQL_Data procedure that is defined for the sample integrating application. It is called by the SmartList to add records to the SmartList window when search criteria have been specified for a SQL-optimized SmartList object. Note how it retrieves the current item from the SQL results set passed in to display the record.

Procedure name: Explorer_Process_SQL_Data

 

in integer IN_Object_Dict_ID;
in integer IN_Object_Type;
in integer IN_Total_SubItems;
in Explorer_Resource_List IN_Dict_List;
in Explorer_Resource_List IN_Field_List;
in long IN_Record_Count;
inout long SQL_Context;

local long status;
local string data_value;

if IN_Object_Dict_ID = IG_PROD_ID then
	if IN_Object_Type = SMARTLIST_OBJECTTYPE_LEADS then
		{Display the current item in the results set. SmartList will move to the next item automatically.}
		status = SQL_GetData(SQL_Context, 1, data_value);

		{Read the record based on the key retrieved.}
		'Lead ID' of table IG_Leads_MSTR = data_value;
		get table IG_Leads_MSTR;

		{Call the routine to display the record}
		call SmartList_Leads_FillOneRowAtTime, IN_Total_SubItems, IN_Dict_List, IN_Field_List, IN_Record_Count, table IG_Leads_MSTR;
	end if;
end if;


Documentation Feedback