Question

Add records from XML file

  • 14 September 2022
  • 6 replies
  • 49 views

Userlevel 1

Hi, how can I achieve this workflow?

  1. user clicks on task
  2. user selects a .xml file as parameter
  3. user executes the task
  4. write logic behind the task which inserts some data into tables based on the information given from the .xml file

(used for Web GUI)
If not so clear let me know. Thanks!


6 replies

Userlevel 7
Badge +19

Hi,

In the Software Factory, we have an example of how you could implement this. When importing a project version, by selecting a model.dat file, that file is linked in the Task. This way you can utilize the Read disk file process action* to Read the file and store it inside a varchar(max) Edit, not varbinary(max) variable. EDIT: Nope… see reply This you then can decompress() and process. 

*Note that this method only works for Windows and Web GUI, and not for Universal GUI.

For context:
 

File upload field
Output assignments of the Read disk file

 

 

For Universal GUI

In case the file cannot be reached with the Read disk file, the newer alternative is to upload the file instead of linking it. With the upload, you'll have both the File name and the File data. Thereafter you can decompress and process the file data the same way as mentioned above. We'll need to change this too for the Software Factory as we work towards compatibility with Universal GUI. 😉

 

Hope this helps!

Userlevel 1

Allright, I’ll try this out and get back to you. Thank you

Userlevel 6
Badge +3

Hello kensonlatchmansing,

To add to Mark’s answer and remove some potential confusion, you will not need to call the decompress function for XML files, because they are not compressed. The task that imports project versions in the Software Factory calls the decompress function because .dat is a compressed (gzip) file format.

I hope this helps.

Userlevel 7
Badge +19

Hello kensonlatchmansing,

To add to Mark’s answer and remove some potential confusion, you will not need to call the decompress function for XML files, because they are not compressed. The task that imports project versions in the Software Factory calls the decompress function because .data is a compressed (gzip) file format.

I hope this helps.

Ohja, thanks! 😅 decompress is indeed not needed

Userlevel 7
Badge +19

Hey @kensonlatchmansing,

Has your question been resolved? 😄

Userlevel 1

Sorry, but I haven’t had the chance to try it out yet.

Reply