Examples: Explorer_AddItem_To_ListView


The following example is the SmartList_Leads_FillOneRowAtTime procedure from the sample integrating application. This procedure is called in the foreground and adds one Lead record to the SmartList window by calling the Explorer_AddItem_To_ListView procedure. Once the item is added, the subitems for the Lead record are added.

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 table IG_Leads_MSTR;

local long n;
local integer l_Count;
local string l_Field_As_String;
local long l_Field_As_Integer;
local date l_Field_As_Date;
local currency l_Field_As_Currency;
local time l_Field_As_Time;
local integer l_Datatype;
local boolean b_Success;

call with name "Explorer_AddItem_To_ListView" in dictionary SMARTLIST,
	'Lead ID' of table IG_Leads_MSTR,
	IN_Record_Count,
	"Leads",
	n;

set l_Count to 1;

while (l_Count <= IN_Total_SubItems) do

{The list of field IDs is contained in the IN_Field_List[] Array}

	case IN_Field_List[l_Count]
		in [resourceid(field 'Lead ID')]
			l_Field_As_String = 'Lead ID' of table IG_Leads_MSTR;
			l_Datatype = SMARTLIST_DATATYPE_STRING;
		in [resourceid(field 'Lead Name')]
			l_Field_As_String = 'Lead Name' of table IG_Leads_MSTR;
			l_Datatype = SMARTLIST_DATATYPE_STRING;
		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;
			l_Field_As_String = itemname('Lead Business Category' of window Dummy of form Command_IG_Sample, 'Lead Business Category' of table IG_Leads_MSTR);
			l_Field_As_Integer = 'Lead Business Category' of table IG_Leads_MSTR;
			l_Datatype = SMARTLIST_DATATYPE_DDL;
		in [resourceid(field 'Potential Revenue')]
			l_Field_As_String = format('Potential Revenue' of table IG_Leads_MSTR, true, true, 2, SYSTEMNEG);
			l_Field_As_Currency = 'Potential Revenue' of table IG_Leads_MSTR;
			l_Datatype = SMARTLIST_DATATYPE_CURRENCY;
		in [resourceid(field 'Contact')]
			l_Field_As_String = 'Contact' of table IG_Leads_MSTR;
			l_Datatype = SMARTLIST_DATATYPE_STRING;
		in [resourceid(field 'Address 1')]
			l_Field_As_String = 'Address 1' of table IG_Leads_MSTR;
			l_Datatype = SMARTLIST_DATATYPE_STRING;
		in [resourceid(field 'Address 2')]
			l_Field_As_String = 'Address 2' of table IG_Leads_MSTR;
			l_Datatype = SMARTLIST_DATATYPE_STRING;
		in [resourceid(field 'City')]
			l_Field_As_String = 'City' of table IG_Leads_MSTR;
			l_Datatype = SMARTLIST_DATATYPE_STRING;
		in [resourceid(field 'State')]
			l_Field_As_String = 'State' of table IG_Leads_MSTR;
			l_Datatype = SMARTLIST_DATATYPE_STRING;
		in [resourceid(field 'Zip')]
			l_Field_As_String = 'Zip' of table IG_Leads_MSTR;
			l_Datatype = SMARTLIST_DATATYPE_STRING;
		in [resourceid(field 'Phone 1')]
			l_Field_As_String = FormatPhoneNumber('Phone 1' of table IG_Leads_MSTR);
			l_Datatype = SMARTLIST_DATATYPE_PHONENUMBER;
		in [resourceid(field 'Phone 2')]
			l_Field_As_String = FormatPhoneNumber('Phone 2' of table IG_Leads_MSTR);
			l_Datatype = SMARTLIST_DATATYPE_PHONENUMBER;
		in [resourceid(field 'Fax')]
			l_Field_As_String = FormatPhoneNumber('Fax' of table IG_Leads_MSTR);
			l_Datatype = SMARTLIST_DATATYPE_PHONENUMBER;
		in [resourceid(field 'Salesperson ID')]
			l_Field_As_String = 'Salesperson ID' of table IG_Leads_MSTR;
			l_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;
			l_Field_As_String = itemname('Qualified Lead' of window Dummy of form Command_IG_Sample, 'Qualified Lead' of table IG_Leads_MSTR);
			l_Field_As_Integer = 'Qualified Lead' of table IG_Leads_MSTR;
			l_Datatype = SMARTLIST_DATATYPE_DDL;
		in [resourceid(field 'Qualification Date')]
			l_Field_As_String = str('Qualification Date' of table IG_Leads_MSTR);
			l_Field_As_Date = 'Qualification Date' of table IG_Leads_MSTR;
			l_Datatype = SMARTLIST_DATATYPE_DATE;
		in [resourceid(field 'Lead Source')]
			l_Field_As_String = 'Lead Source' of table IG_Leads_MSTR;
			l_Datatype = SMARTLIST_DATATYPE_STRING;
	end case;

	call with name "Explorer_AddSubItem_To_ListView" in dictionary SMARTLIST,
		n, 
		l_Count,
		l_Field_As_String,
		l_Field_As_Integer,
		l_Field_As_Date,
		l_Field_As_Currency,
		l_Field_As_Time,
		l_Datatype,
		b_Success;

	increment l_Count;
end while;


Documentation Feedback