Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Defect acknowledgement with Nprinting Engine May 2022 SR2, please READ HERE
cancel
Showing results for 
Search instead for 
Did you mean: 
Marijn
Creator II
Creator II

Is it possible to create XML files in NPrinting?

Hi all,

I wonder whether it's possible to create an XML file from NPrinting. A client expects us to deliver data in an XML, so we made a pivot table with a single cell that has the whole XML text in it. Now I'd like to export this into an XML file, but I see that there's no option to export an XML in NPrinting. Does anyone have an idea for an approach?

Thanks in advance!

Marijn

Labels (2)
1 Solution

Accepted Solutions
Marijn
Creator II
Creator II
Author

Hi @Frank_S and @Ruggero_Piccoli 

We've solved it by creating a single set expression that concatenates all values with the XML format. In this way, there is one field that contains the entire string that needs to become the XML file. I export this as a CSV, then use a .bat file with the command line to convert the file into an XML. The set expression looks something like this:

=chr(10)&
'xmlstatement'&chr(10)&
'<XMLfile>'&chr(10)&

concat(distinct {$<Flag={'xxx'}>}
  '<A>' & chr(10)&
     ' <A1>' & FIELD1 & ' </A1>' & chr(10)&
     ' <A2>' & FIELD2 & '</A2>' & chr(10) &
     ' <A3>' & FIELD3 & '</A3>' & chr(10) &
  '</A>' & chr(10)
)&
'</XMLfile>' & chr(10)

View solution in original post

7 Replies
Frank_S
Support
Support

HI @Marijn

Unfortunately, there is no XML output format available.
Below you will find a list of available formats to export your table information.

Kind regards...

 

Please remember hit the 'Like' button and for helpful answers and resolutions, click on the 'Accept As Solution' button. Cheers!
Marijn
Creator II
Creator II
Author

Hi @Frank_S ,

Thanks for your reply, I'll try to find another solution then.

Kind regards,

Marijn

Ruggero_Piccoli
Support
Support

Hi,

As per @Frank_S 's answer, none of the available types of templates has .xml as a native output format. This could be added as a new feature request on the ideation page Suggest an Idea!

What you could try as a workaround is to create an HTML template, remove all pre-filled HTML code and insert one, or more, Qlik variables created in QlikView or in Qlik Sense that contain the XML code you need. The output will always be a .zip file with the HTML inside so you have to manage the unzip and file extension change outside Qlik NPrinting. I understand that it is not a good and linear solution, I did some tests but I was not able to find a better workaround.

Best Regards,

Ruggero



Best Regards,
Ruggero
---------------------------------------------
When applicable please mark the appropriate replies as CORRECT. This will help community members and Qlik Employees know which discussions have already been addressed and have a possible known solution. Please mark threads with a LIKE if the provided solution is helpful to the problem, but does not necessarily solve the indicated problem. You can mark multiple threads with LIKEs if you feel additional info is useful to others.
Frank_S
Support
Support

Hi @Marijn

If you use the csv export in the entity report/publish task, you can use an external source such as the link below to convert the csv output to xml. (use this external link at your discretion.)

 

https://www.zamzar.com/convert/csv-to-xml/

Otherwise you may consider as Ruggero suggested to insert an 'idea' on our feature request site at the link he shared.

 

Kind regards..

Please remember hit the 'Like' button and for helpful answers and resolutions, click on the 'Accept As Solution' button. Cheers!
Marijn
Creator II
Creator II
Author

Hi @Frank_S and @Ruggero_Piccoli 

We've solved it by creating a single set expression that concatenates all values with the XML format. In this way, there is one field that contains the entire string that needs to become the XML file. I export this as a CSV, then use a .bat file with the command line to convert the file into an XML. The set expression looks something like this:

=chr(10)&
'xmlstatement'&chr(10)&
'<XMLfile>'&chr(10)&

concat(distinct {$<Flag={'xxx'}>}
  '<A>' & chr(10)&
     ' <A1>' & FIELD1 & ' </A1>' & chr(10)&
     ' <A2>' & FIELD2 & '</A2>' & chr(10) &
     ' <A3>' & FIELD3 & '</A3>' & chr(10) &
  '</A>' & chr(10)
)&
'</XMLfile>' & chr(10)
Frank_S
Support
Support

Thank you for sharing your solution!

Please remember hit the 'Like' button and for helpful answers and resolutions, click on the 'Accept As Solution' button. Cheers!
Ruggero_Piccoli
Support
Support

Hi @Marijn ,

Thanks a lot for sharing the solution: it can be useful for other readers.

I have not tested but, maybe, you can do something similar by creating an html template and starting by removing the pre-filled html tags. Then use a .bat to change the generated files extension.

Best Regards,

Ruggero



Best Regards,
Ruggero
---------------------------------------------
When applicable please mark the appropriate replies as CORRECT. This will help community members and Qlik Employees know which discussions have already been addressed and have a possible known solution. Please mark threads with a LIKE if the provided solution is helpful to the problem, but does not necessarily solve the indicated problem. You can mark multiple threads with LIKEs if you feel additional info is useful to others.