OL Learn

Extract multiple fields with one JavaScript based extraction

Hello, hope all is well.

Apologies if this has been covered, the only mention I can find is from a post back in 2015 where the functionality had not been implemented. I am wondering if any updates had been made with this.

I have a long list of XML nodes that need extracting in various loops.

I am looking to extract multiple XML fields using one JavaScript extraction either as extraction step or scripted action.

I am trying to add multiple data model fields with only one JavaScript extraction.

Any pointers on this would be most appreciated.

Thanks, Dav.

Currently, each extraction needs it’s own action. You could have a single script that parses a file and stores values in variables, but each of those variables then needs to be put into a field in the datamodel using an individual extraction step.

I think in order to better help you, it’s going to be important to understand why you have these requirements. Why must it all be done in a single javascript step?

Although I agree with my colleague @AlbertsN as to why would you need to do this in 1 step, it can be achieved as follow, but in 2 steps:

1- Using an Extraction Step, create all the fields you will need as Javascript field, all set to empty string or other default values.

2- Using an Action step, you can then proceed with the extraction of all field an assign them to the previously created datamodel fields.

@hamelj: you don’t even need the initial extraction step: just create the fields directly in the data model pane. Then use a single extraction step to extract all fields at once.

@Phil, @SCCDav…even better :smiley:

Thanks all for your replies.

I have sprawling XML files that have a large amount of varied nodes.

I’m new to mapping XML data and was just trying to streamline my process.

I had opted for defining the fields via XPATH in multiple extraction steps within their loops. Having not been supplied a data map from the customer, I’ve been using PowerShell to interrogate the XML files and map in the nodes.

My Steps processes consists of multiple loops and extractions. All have had their XPATH location manually typed in.

I was hoping for a way to copy and paste the locations from PowerShell to save me time typing them in. The node tree is quite extensive.

@Phil’s comment got me thinking and after experimenting with the Data Model I could have exported the model, amended it using Notepad++ to include all my detailed tables and extract fields, then import it back in. This would have saved me a lot of time.

Perhaps I’m barking up the wrong tree, but I’ve enjoyed playing around with the data mapper in this scenario.