GetXmlPropertyViaUploadField

From SMTX Wiki
Jump to navigation Jump to search

In order to get an XML property from an XML file uploaded via an upload field we have to take some steps:

1. Add an upload field, with internal name for example 'fuXml'

2. Add a read only display field (which you can hide afterwards), with internal name for example 'roXmlLocation'. In this field we will extract the link from the uploaded file, so without the <a href...>..</a>

  Use as dynamic value this calculation:
  GetXmlProperty('#REPLACE-FORMFIELD-UploadXmlTest||fuXml||#', '/A/@HREF')

3. Add a text field (or any other type) where you'll put the xml property in.

  Use as dynamic value this calculation:
  IIF(IsValidPath('#REPLACE-FORMFIELD-UploadXmlTest||roXmlLocation||#'), GetXmlPropertyFromPath('#REPLACE-FORMFIELD-UploadXmlTest||roXmlLocation||#', '/bookstore/book[1]/title/text()'), '')

Example form: http://dev.ssp7.smt-x.com/Forms/form.aspx?adminmode=1&id=502