Submit and vote on feature ideas.

Welcome to the new Parasoft forums! We hope you will enjoy the site and try out some of the new features, like sharing an idea you may have for one of our products or following a category.

How do I access a XML data bank from a script

LegacyForum
LegacyForum Posts: 1,664 ✭✭
edited December 2016 in SOAtest
Can you give me some sample code for accessing a previously populated XML data bank in a script. Thanks.
Tagged:

Comments

  • LegacyForum
    LegacyForum Posts: 1,664 ✭✭
    See the following SOAtest FAQ thread the script in the post is what you want. Instead of using "Untitled" you'll want to use "Generated Data Source". That is the name of all XML Data Bank data sources. The second parameter input should be the name of the XML Data Bank data source column.
  • LegacyForum
    LegacyForum Posts: 1,664 ✭✭
    That sample code shows how to use one datasource. What if we need to access a generated table: "myTable" and an xml data bank: "Generated Data Source" in the script. How does the addDataSources method needs to be changed? Can you show me some sample code. Thanks.
  • LegacyForum
    LegacyForum Posts: 1,664 ✭✭
    Whenever you access from multiple data sources, the iteration over the values is NOT 1-to-1. Instead, it will iterate over the data sources in a combination fashion. For example, assume you have the following data sources:

    DS1:
    1
    2
    3

    DS2:
    4
    5
    6


    During the first iteration it will grab values [1, 4] from DS1 and DS2 respectively. Second iteration it will grab values [1, 5], third iteration it will grab values [1, 6]. Next it will move the cursor by one for DS1 so it points to second row now, thus it grabs values [2, 4] from DS1 and DS2 respectively.

    You can always access Generated Data Source without returning that name from addDataSources(context) method. But if you want to access multiple standard data sources please refer to the following Scripting thread which shows you how addDataSources(context) should be modified to return a collection of data source names.
  • LegacyForum
    LegacyForum Posts: 1,664 ✭✭
    Thanks, this works.