UseWebServiceInForm

From SMTX Wiki
Jump to navigation Jump to search

Sometimes you want to retrieve data from web services while completing a form. SSP provides a NCALC function to lookup web service data from any web service defined in SSP.

The following example is given below: When a value is entered in a text field, SSP should check through web service if that value exists in a datastore and then provide 2 other fields with data from that web service.

Preparations

  • Define a text field
  • Define 2 read-only text fields to contain the looked up data
  • Define a generic web service on the datastore to lookup the data

Default answers on read-only fields

The read-only fields should get the NCALC function defined in their Dynamic value setting:

 WebserviceLookup('Datastore - Get data - AD building', 'Building Code', 'FilterName', '#REPLACE-FORMFIELD-WebserviceTest||Name||#')

The example above shows a web-service call to the web service named "Datastore - Get data - AD building" and retrieving the field "Building Code". The list with building is filtered with the value entered in the first text field "WebserviceTest". You can set any number of filters, as long as the used filtered is defined within the web service.