Forum Discussion

alibaba82's avatar
alibaba82
Super Contributor
17 years ago

XQuery question

Hello,
I am a little confused about XQuery and its use and wondering if you could answer my question.

I have a method while give me the following response.


             
                  e3c259d2-e094-466c-bd5b-21a67dffa752
                  DVC_ON_NOW
                  DeviceLocal
                  My Channels on Now
                 
                  true
                  true
                  DeviceLocal
                  1
                  2007-07-19T21:50:45Z
                  true
             

             
                  1cc85b6d-0037-4e8c-bd8f-6e0ecef7f293
                  DVC_ON_NEXT
                  DeviceLocal
                  My Channels on Next
                 
                  true
                  true
                  DeviceLocal
                  2
                  2007-07-19T21:50:45Z
                  true
             



I want to grab 'ModuleCode' and use it as an input for another request. This way I want to go through all the 'ModuleCodes' from the Get function.

Is it possible to XQuery to query all the 'ModuleCodes' from the get response and write them to a datagrid and then have  a datasource loop through them. Currently I write all the 'moduleCodes' to an external file and then use a file datasource to loop through them.

Thanks

Ali

1 Reply

  • omatzura's avatar
    omatzura
    Super Contributor
    Hi Ali,

    thanks for your post.. I think you can achieve this in the following way:

    1) Create an XML DataSource in your DataSource step, set the source step/property to the request/response containing this xml
    2) Add a "ModuleCode" property to the DataSource
    3) For the "Row XPath", enter //ModuleId
    4) For the "Column XPaths", set the created one to ModuleCode/text()
    -> this is relative to the Row XPath

    (you may need to add a namespace definition to the row-xpath)

    In this way you should be able to bypass both the external file or use of a Grid altogether..

    Let me know if I got it right and if/how this works for you!

    regards,

    /Ole
    eviware.com