Please note that VisualCron support is not actively monitoring this community forum. Please use our contact page for contacting the VisualCron support directly.


Neil Frost
2017-04-03T15:08:22Z
Hi
I have a response from a web site in XML which looks like this:

<devices>
   <device>
        <deviceid>def234</deviceid>
        <name>ANName</name>
        <address1>15 Nowhere</address>
   </device>
   <device>
        <deviceid>ghi345</deviceid>
        <name>YouName</name>
        <address1>21 Tuesday Street</address>
   </device>
   <device>
        <deviceid>abc123</deviceid>
        <name>MyName</name>
        <address1>12 Somewhere</address>
   </device>

...... and so on

</devices>


I then have another set of web services to return iterating through the XML eg

I've returned the XML above in VisualCron
I need to access http://mywebsite.com/webdetails/<deviceid> 

This will return a set of XML for the next part of the process

<webdetails>
     <deviceid>abc123</deviceid>
     <type>mobile</type>
     <color>black</color>
    <make>Tesco</make>
........
</webdetails>


I would write this to an xml file called <deviceid>_details.xml

eg I should at the end of the task return 3 files (or as many files as there are deviceid's)
abc123_details.xml
def234_details.xml
ghi345_details.xml

I'm assuming that I would use the loop function, but I'm not sure how to pick up the deviceid and pass that to the next tasks URL then iterate through the process again for the next deviceid.

Could someone help please?

Thanks
Sponsor
Forum information
thomas
2017-04-04T13:00:05Z
I don't use xml a lot, so I can't help you there. But generally speaking, if you want to do a nested loop in VisualCron, the second loop must be a separate job. So in job1 you create a loop, fetch the data you need, and the call a another job (using the Internal - job/task control). In the second job you can have a new loop.


ErikC
2017-04-06T06:08:43Z
Hi,

To read the deviceid's, you need a Read Node task for the XML file.
Use the xpath query:

//deviceid

and deselect the optioin 'select single node'.
This should give a list of all the deviceid's in the XML file.

The next tasks are in a loop and the loop uses the previous list as the itterator. So you can use the current X value variable as the deviceid.
You can use tasks to query a new webserver and save data to a file, all using the current X value variable in the loop.


Good luck!
Erik

NB, your XML files has an error, the address tag start with <address1> and closes with an </address> tag. Typo? The 1 is wrong here.
Uses Visualcron since 2006.
ifeguy
2017-08-21T17:46:39Z
Hi Eric,

Thank you for posting this. I have been trying to figure this out for a while.

I was able to create a task to pull all the GUIDs, but I am still struggling to execute your approach. ..not exactly sure how/where to define the loops.

My XML is the following.I am using GUID as the unique id for each item. Ultimately, I need to enter each item into an SQL database. Any advice is greatly appreciated. Thank you!

<item>
<guid isPermaLink="false">91bf6c49-ccf2-4e35-b17c-e98602ed967d</guid>
<title>Title 01</title>
<description>This is the description for title 01</description>
<media:content ype="video/mp4" url="https://test/penty081617d_1756.mp4"/>
<media:thumbnail isDefault="false" url="https://test/640x-5.jpg"/>
<pubDate>Wed, 16 Aug 2017 17:02:24 GMT</pubDate>
</item>

<item>
<guid isPermaLink="false">b6b0402f-f2d4-489a-818d-ed3c8786bc20</guid>
<title>Title 02</title>
<description>This is the description for title 02</description>
<media:subTitle type="application/ttml+xml" lang="en-us" url="https://test/penty081617d_CC.DFXP"/>
<media:content ype="video/mp4" url="https://test/penty081617d_1800.mp4"/>
<media:thumbnail isDefault="false" url="https://test/640x-1.jpg"/>
<pubDate>Wed, 16 Aug 2017 08:41:09 GMT</pubDate>
</item>
Scroll to Top