Examples: XMLDoc_Create


The following is the complete GeneratePreviewPaneXML procedure defined for the Leads card list in the sample integrating application. It uses the XMLDoc_Create procedure to start the process of creating the XML content to be displayed in the Information Pane. After the content has been specified, the XMLDoc_Save procedure is called to complete the process.

inout ListObjState list_object;
inout string XMLFilePath;
inout string sTitle; 

local ListPrevPaneXMLState XMLState;
local string sName;
local string sValue;
local integer iAlignment;
local reference Leads_MSTR_Temp;

{Get the reference for the temporary table used by the list}
Leads_MSTR_Temp = list_object:'Table Reference';

sTitle = str('Lead ID' of table(Leads_MSTR_Temp)) + CH_SPACE + CH_COLON + CH_SPACE + 'Lead Name' of table(Leads_MSTR_Temp);

{ Build up basic XML file }
call XMLDoc_Create of form syListObj, XMLState, XMLFilePath, sTitle;

{Add the fields that will be displayed}

{--Column 1--}

{Address}
sValue = 'Address 1' of table(Leads_MSTR_Temp);
call XMLDoc_AddHeaderField of form syListObj, XMLState, "Address", sValue, 1;
sValue = 'Address 2' of table(Leads_MSTR_Temp);
call XMLDoc_AddHeaderField of form syListObj, XMLState, "", sValue, 1;

{City, State, Zip}
sValue = 'City' of table(Leads_MSTR_Temp) + ", " + 'State' of table(Leads_MSTR_Temp) + " " + 'Zip' of table(Leads_MSTR_Temp);
call XMLDoc_AddHeaderField of form syListObj, XMLState, "", sValue, 1;

{Phone 1}
call GetColumnName of form ListObj_Leads, resourceid(field 'Phone 1'), 0, sName;
call FormatField of form ListObj_Leads, Leads_MSTR_Temp, resourceid(field 'Phone 1'), 0, 1, sValue, iAlignment;
call XMLDoc_AddHeaderField of form syListObj, XMLState, sName, sValue, 1;

{Phone 2}
call GetColumnName of form ListObj_Leads, resourceid(field 'Phone 2'), 0, sName;
call FormatField of form ListObj_Leads, Leads_MSTR_Temp, resourceid(field 'Phone 2'), 0, 1, sValue, iAlignment;
call XMLDoc_AddHeaderField of form syListObj, XMLState, sName, sValue, 1;

{Fax}
call GetColumnName of form ListObj_Leads, resourceid(field 'Fax'), 0, sName;
call FormatField of form ListObj_Leads, Leads_MSTR_Temp, resourceid(field 'Fax'), 0, 1, sValue, iAlignment;
call XMLDoc_AddHeaderField of form syListObj, XMLState, sName, sValue, 1;

{--Column 2--}

{Lead Category}
call GetColumnName of form ListObj_Leads, resourceid(field 'Lead Business Category'), 0, sName;
sValue = itemname('Lead Business Category' of window State, 'Lead Business Category' of table(Leads_MSTR_Temp));
call XMLDoc_AddHeaderField of form syListObj, XMLState, sName, sValue, 2;

{Contact}
call GetColumnName of form ListObj_Leads, resourceid(field 'Contact'), 0, sName;
sValue = 'Contact' of table(Leads_MSTR_Temp);
call XMLDoc_AddHeaderField of form syListObj, XMLState, sName, sValue, 2;

{Potential Revenue}
call GetColumnName of form ListObj_Leads, resourceid(field 'Potential Revenue'), 0, sName;
call FormatField of form ListObj_Leads, Leads_MSTR_Temp, resourceid(field 'Potential Revenue'), 0, 1, sValue, iAlignment;
call XMLDoc_AddHeaderField of form syListObj, XMLState, sName, sValue, 2;

{--Column 3--}

{Qualified Lead}
call GetColumnName of form ListObj_Leads, resourceid(field 'Qualified Lead'), 0, sName;
sValue = itemname('Qualified Lead' of window State, 'Qualified Lead' of table(Leads_MSTR_Temp));
call XMLDoc_AddHeaderField of form syListObj, XMLState, sName, sValue, 3;

{Qualification Date}
call GetColumnName of form ListObj_Leads, resourceid(field 'Qualification Date'), 0, sName;
call FormatField of form ListObj_Leads, Leads_MSTR_Temp, resourceid(field 'Qualification Date'), 0, 1, sValue, iAlignment;
call XMLDoc_AddHeaderField of form syListObj, XMLState, sName, sValue, 3;

{Source}
call GetColumnName of form ListObj_Leads, resourceid(field 'Lead Source'), 0, sName;
sValue = 'Lead Source' of table(Leads_MSTR_Temp);
call XMLDoc_AddHeaderField of form syListObj, XMLState, sName, sValue, 3;

{Save the XML document.}
call XMLDoc_Save of form syListObj, XMLState;


Documentation Feedback