When I submit my form I am getting a flat XML document out. I would like to have the XML data formatted in tree form to make datamapping easier. Is there a way to do that in my form or do I need to do that in the datamapper? And how?
Thanks
When I submit my form I am getting a flat XML document out. I would like to have the XML data formatted in tree form to make datamapping easier. Is there a way to do that in my form or do I need to do that in the datamapper? And how?
Thanks
Welcome to our community, Dogsrule!
Your best bet would be to transform your XML using Workflow’s Open XSLT task. However, I am not sure I understand your statement “I would like to have the XML data formatted in tree form to make datamapping easier”. Could you post samples of the current structure and of the desired structure so we can better understand what you’re looking for?
Make sure the samples contain only anonymized data.
Hi
Sorry it’s taken me so long to respond. Been caught up in other projects.
As you can see from the attached xml file, there is no structure to the file. Also, this particular file will not load into the datamapper…
0826220submit_results.xml (24.4 KB)
I would like to see it more like the following:
more like this.xml (4.3 KB)
These are coming out of COTG using NodeJS…
Thanks
Both those files are invalid. XML element names cannot contain [ ]
characters.
So the first order of the day is to fix the original file to make it XML compliant.
All elements like:
<CustInfo[row_3][Addl1]>Contact name</CustInfo[row_3][Addl1]>
should be changed to something like
<CustInfo row_3="" Addl1="">Contact name</CustInfo>
That change must be applied to all similarly invalid elements (like the worksheet_table
elements later in the file). In addition, ampersands are not allowed in XML element names. So the Reduce&Enlarge
element should be renamed to something like Reduce_Enlarge
.
The easiest way to fix all that is to modify the HTML form you are using. If you can’t do that, then you will need to use a script in Workflow. You won’t be able to use pure XSLT transformation since the source XML file is invalid (well… it could still be done with XSLT, but it would probably be more complex than using a script).
One you have that done, you’ll be a ble to load the file in the datamapper. You will then be able to extract and group the fields properly
Attached is a sample (and incomplete) Demo.OL-datamapper (12.4 KB) that extracts some of the data and groups elements according to your specs.
Hopefully, this will get you started.
Thanks Phil
Except for the ampersands, the additional brackets in, <CustInfo[row_3][Addl1]>Contact name</CustInfo[row_3][Addl1]> and the worksheet_table, are being generated by COTG as they are not in my orginal form…
Once I get the xml file out from COTG I want to be able to plug it back into a connect form and create detail tables into a PDF, therefore groups will not be of benefit in this instance.
Hopefully, that makes more sense to you now.
Thanks for all you do!