Examples: Explorer_Search_Generic


The following example from the sample integrating application fills the Leads SmartList object with records. The Explorer_Search_Generic procedure is called to determine whether the current record matches the search criteria specified by the SmartList user. This check occurs only if the object indicates that it is not optimized for SQL.

in integer IN_Total_SubItems;
in Explorer_BOOL_List IN_Searching;
in Explorer_Resource_List IN_Dict_List;
in Explorer_Resource_List IN_Field_List;
in Explorer_INT_List IN_Field_Dict_ID;
in Explorer_INT_List IN_Field;
in Explorer_INT_List IN_Datatype;
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 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;

inout long IO_Max_Records;

in boolean IN_GetSummary;
in integer IN_Summary_Type; {0 = Number of records, 1 = Total of Column}
inout integer IO_SummaryCount;
in integer IN_nSummaryFieldDictID;
in integer IN_nSummaryFieldID;
inout currency IO_ColumnTotal;

local boolean b_Stop, b_Found;
local long l_Record_Count,SQL_Context;
local integer l_Key,Error;

{This block of code will be run only if the Explorer_Optimize_For_SQL procedure returns false}
if 'SQL Server' of globals > 0 and (IN_Searching[1] or IN_Searching[2] or IN_Searching[3] or IN_Searching[4]) then

	call with name "Explorer_SQL_Search_Generic" in dictionary SMARTLIST,
		IG_PROD_ID,
		SMARTLIST_OBJECTTYPE_LEADS,
		IN_Searching,
		IN_Field_Dict_ID,
		IN_Field, 
		IN_Datatype, 
		IN_Type, 
		IN_Search_From, 
		IN_Search_To, 
		IN_Match_Case,
		IN_Field_Comparison,
		IN_Start_Comp_Field_ID,
		IN_Start_Comp_Field_Dict,
		IN_End_Comp_Field_ID,
		IN_End_Comp_Field_Dict,
		IN_Global_Search_Type, 
		SQL_Context,
		Error,
		IN_GetSummary,
		IN_Summary_Type,
		IO_SummaryCount,
		IN_nSummaryFieldDictID,
		IN_nSummaryFieldID,
		IO_ColumnTotal;
	
	{If Error returns -1, then a sequential search should be used}
	if Error = OKAY then
		call Explorer_Process_SQL_Data, IG_PROD_ID, SMARTLIST_OBJECTTYPE_LEADS, IN_Total_SubItems, IN_Dict_List, IN_Field_List, IO_Max_Records, SQL_Context;
		abort script;
	end if;
end if;

{This is the traditional SmartList code that works for all database types}

set l_Record_Count to 0;
set l_Key to 1;
call with name "Explorer_Check_Stop_Processing" in dictionary SMARTLIST, b_Stop;

{ Loop through table to get records }
get first table IG_Leads_MSTR by number l_Key;
while(err() <> EOF) and (l_Record_Count < IO_Max_Records) and (not b_Stop) do
	{Set the global SmartList Master ID}
	SmartList_Master_ID of globals = 'Lead ID' of table IG_Leads_MSTR;

	call with name "Explorer_Search_Generic" in dictionary SMARTLIST,
		IG_PROD_ID,
		SMARTLIST_OBJECTTYPE_LEADS,
		IN_Searching,
		IN_Field_Dict_ID,
		IN_Field,
		IN_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,
		b_Found;

	if b_Found then
		increment l_Record_Count;
		call foreground SmartList_Leads_FillOneRowAtTime,
			IN_Total_SubItems,
			IN_Dict_List,
			IN_Field_List,
			l_Record_Count,
			table IG_Leads_MSTR;
	end if;

	get next table IG_Leads_MSTR by number l_Key;
	call with name "Explorer_Check_Stop_Processing" in dictionary SMARTLIST, b_Stop;
end while;


Documentation Feedback