Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

Storing and retrieving an xml variable in DB

kc
Level 8
Level 8
Hi all,



I am having some trouble storing and retrieving an xml variable in a custom DB. Can it be done via the jdbc-services or do I need to create some custom code which I call in an execute script?



In either case, how?



Thanks in advance



Sincerely

Kim Christensen
7 Replies
Jasmin_Charbonn
Level 10
Level 10
"Can it be done via the jdbc-services?"

Yes



You might want to store it in a String variable if you run into problem with the XML.



Jasmin
kc
Level 8
Level 8
Ok, thanks alot...



I just had the problem that I didn't get any data inserted in the database.



I have set up the execute sql service to the following:



SQL Statement:



insert into table1 values({$ /process_data/@id $}, '{$ /process_data/formdata $}')



This inserts the processInstanceID in the DB but no data is inserted. I have also tried:



insert into table1 values({$ /process_data/@id $}, {$ /process_data/formdata $}) (without the quotes (' and '))



But this time the server gets an exception parsing the xml.



How should I set up the SQL statement to insert my xml-variable "formdata" into the DB?



Thank you in advance



Sincerely

Kim Christensen
pguerett
Level 10
Level 10
That is because you are not referencing your form data correctly. How is formdata defined? Are you doing this from a submitted form (through workspace)?
Jasmin_Charbonn
Level 10
Level 10
You might have to convert it into a string.



Use the function serialize(/process_data/formdata) to have a string representation of you XML.



Jasmin
kc
Level 8
Level 8
The form is submitted by email and the process is kicked of by an email endpoint. How should I reference my formdata variable?



\Kim
pguerett
Level 10
Level 10
What is the variable type tha is recieving the submitted data? XML?
kc
Level 8
Level 8
Sorry for the late post - I got it working at last but just inserting the xml as a string into the db



Kim