More than one datapool to a script in RFT

好久不见. 提交于 2019-12-11 02:52:37

问题


Is there any way can we add two datapools to a single script? Or in other words how can we get inputs from two different datapools to a single script.

Thanks in advance.


回答1:


Yes, you can manually load and manage any number of datapools.

    /**
 * Creates a IDatapoolIterator pointing the first record
 * @param datastore default project path
 * @param dataPoolPath relative path in the project
 * @return IDatapoolIterator pointing the first record
 */
public static IDatapoolIterator getDataPoolIterator(String datastore, String dataPoolPath)
{
    java.io.File dpFile = new java.io.File(datastore, dataPoolPath+".rftdp");

    DatapoolScriptSupport dss = new DatapoolScriptSupport();

    IDatapool dp = (IDatapool) dss.dpFactory().load(dpFile, true);
    IDatapoolIterator dpIter = dss.dpFactory().open(dp, null);

    dpIter.dpInitialize(dp);
    dpIter.dpReset();

    return dpIter;
}

then in your code

myDatapool = getDataPoolIterator((String)getOption(IOptionName.DATASTORE), "relative/path/intheproject");

You can access any Variable in the datapool by

myDatapool.dpString("Variable");

Use the correct method depending the type of the variable you need. Using

myDatapool.dpNext();

you will advance to the next record in the datapool. Hope this will help. Further informations here: IBM Help System: Datapool



来源:https://stackoverflow.com/questions/8532061/more-than-one-datapool-to-a-script-in-rft

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!