2011-12-16 2 views

答えて

2

はい、任意の数のデータプールを手動でロードして管理できます。

/** 
* 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; 
} 

は、あなたのコード

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

にあなたが必要とする変数の型を依存し、正しい方法を使用し

myDatapool.dpString("Variable"); 

によりデータプール内の任意の変数にアクセスすることができます。

myDatapool.dpNext(); 

データプールの次のレコードに進みます。 これが役立つことを願っています。 詳細情報:IBM Help System: Datapool

+0

上記のスニペットは、スクリプトに関連付けられていないデータプールにアクセスするために使用できますか? – Sarathee

+0

はい、プロジェクトパス内にある限り、必要なデータプールを読み込むことができます: – ADR

+0

はい、うまく動作しています...実際には、パスに間違いがありました。thnxのヘルプ..... – Sarathee

関連する問題