You will add a procedure to your integrating dictionary that will add a single row to the SmartList for the new SmartList object you are creating. This procedure will use the Explorer_AddItem_To_ListView procedure to add the item to the list view. The procedure will have an array of the fields that should be added as columns for the list view. You will use the Explorer_Add_SubItem_To_ListView procedure to add the additional columns selected by the user.
This procedure is directly adding items to the list view that the user will see, any formatting to apply (such as currency formatting) must be done in this procedure. |
As an example, the following is the SmartList_Leads_FillOneRowAtTime procedure that is defined for the sample integrating application. It is called by several other procedures to add individual rows for the Leads SmartList object.
Procedure name: SmartList_Leads_FillOneRowAtTime
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 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;