GetDataFromDataStore

From SMTX Wiki
Jump to navigation Jump to search

New feature since 17/11/2014.

You can now pull data from a Datastore Parameter, in a process.
The WebService needs a filterField, and potentially a SortField.

An example is made in our DEV : Datastore - GET - Address Book

Components:

URL : http://dev.ssp7.smt-x.com/Common/webservice/datastore.asmx
Call Type: RetrieveList
Return Type: DataTable
XLST In: see example - note the HASH ! - see full sample below
XSLT Out : see example - no Hash here - see full sample below
Web Service Call Headers: none
WebService Call Fields:

- Filter<FieldName>: Will be needed to find the correct value in the Datastore Parameter.
- Sort<FieldName>: (optional) : sort the results by this field, the first entry will be chosen.

Only 1 entry can be chosen !
Multiple filters can be selected
sample form : http://dev.ssp7.smt-x.com/Forms/Admin/formDetail.aspx?id=291
sample process: http://dev.ssp7.smt-x.com/Workflow/Admin/ProcessAddEdit.aspx?saved=true&genericid=233

The process first pulls data based on the field in the form.
Next, it asks in the process to select an email address and will then return the Name & Location. sample ticket : 2255


It is a bit complex how to set up the call in the process.
The step type is 'Webservice Call', but when you select a 'GET'-webservice, the Form section appears.
This allows you to fetch the fields from the datastore that you want (and use them as 'previously entered fields').
Note: add the fieldname (of the datastore parameter) in the new textfield, labeled 'Field name from webservice call'.



XSLT In Sample

<?xml version='1.0'?> <xsl:stylesheet xmlns:xsl='http://www.w3.org/1999/XSL/Transform' version='1.0'> <xsl:template match='/SSPAdapterCall'> <soapenv:Envelope xmlns:soapenv='http://www.w3.org/2003/05/soap-envelope' xmlns:dat="http://smt-x.com/SSP/Common/DataStore"> <soapenv:Header/> <soapenv:Body> <dat:getEntries> <dat:p_strParameterName>Address Book</dat:p_strParameterName> <dat:p_strHash>1E6F5F9F37A94F572DEB3BCB87CF53635741C43C</dat:p_strHash> <dat:p_blnIsHidden>false</dat:p_blnIsHidden> <dat:p_strSortFieldName></dat:p_strSortFieldName> <dat:p_arr_strExistingNameValues> <xsl:for-each select="Field"> <xsl:variable name="FieldName" select="@Name"/> <xsl:if test="starts-with($FieldName, 'Filter')"> <dat:string> <xsl:value-of select="substring($FieldName, 7)" /> </dat:string> <dat:string> <xsl:value-of select="." /> </dat:string> </xsl:if> </xsl:for-each> </dat:p_arr_strExistingNameValues> </dat:getEntries> </soapenv:Body> </soapenv:Envelope> </xsl:template> </xsl:stylesheet>




XSLT Out Sample


<?xml version='1.0' ?> <xsl:stylesheet version='1.0' xmlns:xsl='http://www.w3.org/1999/XSL/Transform' xmlns:soap='http://www.w3.org/2003/05/soap-envelope' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:ds='http://smt-x.com/SSP/Common/DataStore'> <xsl:template match="/soap:Envelope/soap:Body/ds:getEntriesResponse"> <SSPAdapterResult> <Fields> <xsl:for-each select='//xsd:element[@name="Data"]/xsd:complexType/xsd:sequence/xsd:element'> <Field> <xsl:value-of select='@name' /> </Field> </xsl:for-each> </Fields> <Rows> <xsl:for-each select='//DocumentElement/Data'> <Row> <xsl:for-each select='*'> <Field> <xsl:attribute name="name"> <xsl:value-of select="local-name()" /> </xsl:attribute> <xsl:value-of select='.'/> </Field> </xsl:for-each> </Row> </xsl:for-each> </Rows> </SSPAdapterResult> </xsl:template> <xsl:template match="/soap:Envelope/soap:Body/soap:Fault"> <Error>code:<xsl:value-of select='soap:faultcode' /> <xsl:value-of select='soap:Code/soap:Value' /> - string:<xsl:value-of select='soap:faultstring' /> <xsl:value-of select='soap:Reason/soap:Text' /> </Error> </xsl:template> </xsl:stylesheet>