XML
0

Hello :)
I have a process where I generate an XML file. I would now like to extract this XML file in another process with a sustainable solution. My XML file contains multiple fields as well as lists. What would be the easiest way to achieve this using WEBCON? I was thinking of writing the content of my XML file into a technical multiline text field via SQL and then extracting it with the "Change Values" action. The lists would be handled with the "Update Item List" action. Is this possible? Thank you very much for your help!

MVP

Hi Mario,

yes, your idea can work.
- You can extract the text from a plain text file and store it in a field and maybe in an automation parameter:
https://daniels-notes.de/posts/2024/importing-applications-using-an-application#business-rules
- You can then use "for xml" in an sql command
https://learn.microsoft.com/en-us/sql/relational-databases/xml/for-xml-sql-server?view=sql-server-ver16

With "for xml" you could return different result sets. One for setting multiple fields and others for the item list.

If this doesn't work for any reason, you could switch over to SDKs. If you have a developer at hand and you have the SDK license.
Here's an old example on populating an item list based on an XML.
https://daniels-notes.de/posts/2021/custom-action-xml-to-item-list#download

Best regards,
Daniel

MVP
In reply to: Mario

Hi Daniel!

Thank you for your quick reply. I am currently trying to implement this. However, I do not quite understand how to access the content of the attachment. I have a normal XML file in this process.
You use a SQL statement to get the ID of the attachment with the database set to current. But for querying the content and how you convert it, you use an Attachment DB (which I do not have).
How do I access the content if I keep the database set to current and use the SQL statements like you do? When I try to access the content, I get an error.

Hi Mario,

if you don't have an attachment database, you can simply use your content database. If you execute your statement in SQL management studio, I would guess that it is working.
You are probably receiving an error, because you use "Current connection". This uses the "bps_user" which, in my version, is not allowed to access the "WFAttachmentFiles" table.

If you use/create another connection with a dedicated user and appropriate permissions, it should work.

Best regards,
Daniel