convert XML file to object in rollbase

Posted by reutshirel on 01-Mar-2016 05:29

hello!!

In addition to this question https://community.progress.com/community_groups/rollbase/f/25/t/8957 

I want to store all the books as follows:

 - the ID of the books be the "primary key", all the IDs will store in pick-list.

the user choose one ID and then all the fields will be complete respectively.

My questions is: 

1. How to store the ID elements in the pick-list?

2. How to get the other suitable fields from the file?

3. The XML file is from the Internet, How can I import it? (file-upload is not suitable).

Thank,

shirel

All Replies

Posted by Varun Tayal on 03-Mar-2016 01:33

Hi Shirel,

Can you please explain your requirement?

1. How to store the ID elements in the pick-list?

>>> You can create an Object representing ID's. For each ID create a records and use it as a related record in you main object.

2. How to get the other suitable fields from the file?

>>> Do you want to get fields from xml file? community.progress.com/.../8957

This link explains the same right?

3. The XML file is from the Internet, How can I import it? (file-upload is not suitable).

>>> You can use an HTTP GET trigger to get the value of XML.

Posted by reutshirel on 03-Mar-2016 04:29

Hi Varun,

Thank you for your help.

I will try to explain my requirement.

1. According to your solution - How  I can get the ID`s values from the XML and create object?

   I need to pass on all the object and get the `ID` field - Can I do it with 'for'  loop?

2. If I understood correctly, I call the trigger for any object and get the suitable fields?

3. If I use the HTTP GET trigger, I need to change the two first lines from the attached link, no?

I am new in this topic on rollnbase, If you have a link to toturial I will be grateful.

I hope I have explained myself more clearly!!

Thanks again,

shirel

Posted by Varun Tayal on 04-Mar-2016 01:00

Hi Shirel,

What I understood is that you want to have a list books in your system. But you want to create the records for object "Book" from XML which comes through a URL. And once you have all the list of books in place. You want to show list of ID's as pick list in some other object lets say "Book Order" such that when user select one of the ID's other fields should be automatically filled with the values of that particular book record.

Is my understanding correct?

Posted by reutshirel on 08-Mar-2016 05:35

Ya! That exactly what I mean!

Meanwhile, I use the URL as XML file (I save it in my desktop).

- How I get the ID`s from the URL (that displayed as XML) and store as objects?

Thanks for your help!

shirel

Posted by Varun Tayal on 15-Mar-2016 14:08

Can you please share the sample xml files?

Posted by reutshirel on 22-Mar-2016 03:03

<library>

  <book>

     <id> 123 </id>

     <name> Harry Potter </name>

     <auther> JK Rolling </auther>

     <price> 25$ </price>

  </book>

  <book>

.....

  </book>

.....

</library>

This XML file come from web link and updated every few minutes.

My questions are:

1. How to get this file while is updates?

2. How to create instances of the "Book" object  for each book from the file and update them

   according to the file updates?

Thanks,

Shirel

This thread is closed