Getting single record from xml file

Hi There

I have an xml document which I have imported into a data mapper. However I am trying to get a single structure from this but am not being very successful. Each new records starts on the document tag. Field name is in the following field:-

RA_SURNAME

That value of that field is in the following field:-

Sample

This can be repeated a few times. How would I go about getting a single record out of this please?

I have put a sample of the XML file below:-

Thanks In Advance!


302
1
auto





  RA_SURNAME
  Sample


  RA_TITLE
  Mr




  RA_SURNAME
  Sample


  RA_TITLE
  Mr

If you set the XML Elements to /XML/Document, then title and surname are available as single records. Is that not what you need?

Hi There

I need every thing under each document tag to be 1 record.

So title and surname need to come under 1 record not two single records?

Thanks

I did not try a extract but see what you mean. Until someone more experienced with XML chimes in I did manage to get it right. Just not sure if it is the best way to go about it.

Settings:

  • Input Data:
    • XML Elements = /XML/DOCUMENT
  • Boundaries:
    • Trigger = On Element
    • Occurrences = 1

Steps:

  1. I added TPS_VAR_VAL twice to a Extraction.
  2. Therefore got two fields called TPS_VAR_VAL & TPS_VAR_VAL2.
  3. Renamed field TPS_VAR_VAL to Surname and TPS_VAR_VAL2 to Title. (For clarity.)
  4. Selected the Title field in the Fields List of the extraction.
  5. Changed the Title field Based On to JavaScript
  6. Changed the JavaScript to - data.extract(‘./DOCUMENT/VARIABLE[2]/TPS_VAR_VAL’);

Hope that helps.

Regards,

S

Hi

That seems to be exactly what I need! Thank you for your help!

Regards

ER