1. Michael Hartnett
  2. PowerBuilder
  3. Wednesday, 10 July 2019

Hi All,

Hoping some of the gurus out there can help with this.

I am currently trying to make use of the XML Import Templates on Datawindows in an existing legacy project.  I have previous experience of using PBDOM and parsing XML file via large amounts of code, but wanted to see if the XML Import Templates could be used to simplify my development this time around.

For the moment the application is being maintained in PB 10, but this should not matter.

Below is a screenshot of my DW.  I have created a test DW for this query, but the structure of the XML and premise will remain the same for more complicated data.  The test DW has 4 columns per row.  The XML File contains multiple groupings under multiple elements.  I am attempting to populate each column for each row using the XML Import.

Below is a sample of the XML being used for the import.  It is very simple data with multiple groupings.

When I import the file using the applied template, I get the following result in the DW.  The uploadid does not populate, while the workid will only populate for the first row.

I am sure I am missing something in the iteration of the XML Template, but have not used it enough to understand how to get it to process as it should.  I am also unable to start the detail of the import at the Upload Element, which I suspect is why the uploadid does not import.

I am trying to achieve the below result set after the import.

I have attached the test datawindow and test xml is anybody can help or provide me with the template that would allow me to import all the data on each row.

Thanks in advance

Michael

Attachments (1)
0
Votes
Undo

Yes, the XML import is almost a kludge on the CSV import, I think my guys would say "it almost nearly very good".

It will always require some pre formatting to get it to DW XML standard tongue-out

Comment
There are no comments made yet.
  1. Monday, 22 July 2019
  2. PowerBuilder
  3. # 1
Matthew Balent Accepted Answer Pending Moderation
2
Votes
Undo

IMHO...

This was another 'half baked' (as in half done) effort/feature by Sybase.  Unless you are doing something extremely simple you really cannot use the XML capabilities of the datawindow without 'pre' and/or 'post' processing.

Comment
It is a shame that something so often used in a company is not easily resolved by the various companies that take over PowerBuilder ... it's so complicated to create a DW by importing an .XSD or .XML file? it's more difficult to create a language, in the end the developers have to use imagination or many hours to give exclusive solutions.
  1. Eduardo G.
  2. Monday, 22 July 2019
There are no comments made yet.
  1. Friday, 19 July 2019
  2. PowerBuilder
  3. # 2
Michael Kramer Accepted Answer Pending Moderation
0
Votes
Undo

Hi Michael, I struggled with PB's XML import/export for DataWindows vs. how a .NET based nation-wide web service expected the XML to look. One example: How to handle NULL values.

The solution we ended up with was nested DataWindows exporting an "internal XML format" which we passed through an "afterburner" NVO massaging/transforming the XML to the web-service's requirements.

AND - for importing: Receive XML from the web-service, then massage/transform it into the "internal XML format" using a "pre-burner" NVO. There was no way to avoid some pre/post processing. We still relied on DataWindow's import capabilities since it reduced total source code to develop/maintain.

Note on import: We import same XML text into multiple different datastores each importing its own level/segment of XML. It took some effort to get the code right and to learn the intricate details of DW's XML capability. But once the code was done it has been rock solid.

HTH /Michael

Comment
Thanks for the advice Michael,



Unfortunately, I do not this will not work of us as we are receiving the XML files from an external supplier.



I have found that leaving out the Data Start line on the XML Template I can get all the data into the DW, including the parent element attributes. These only import on the first row, I have resolved the repetition of the data, by using a loop after the file is imported, to fill down the data to each row.



Thanks Anyway

Michael
  1. Michael Hartnett
  2. Tuesday, 16 July 2019
There are no comments made yet.
  1. Friday, 12 July 2019
  2. PowerBuilder
  3. # 3
  • Page :
  • 1


There are no replies made for this question yet.
However, you are not allowed to reply to this question.