文字查閱
動詞:lookupCommand
可用來源: <Enterprise>
使用比較演算法(例如,「聲音編譯」或「模糊」)的基準來查閱文字集合或資料表中的特定文字。
語法
lookupCommand --culture(Culture) --source(LookupOptions) --algorithm(TextSearchAlgorithms) --soundexalgorithm(Nullable<SoundExAlgorithms>) --fuzzyalgorithm(Nullable<FuzzyStringComparisonAlgorithms>) --tolerance(Nullable<FuzzyStringComparisonTolerance>) --sourceCollection(ICollection<String>) --sourcedatatable(DataTable) [--usecolumnname(Boolean)] --index(Numeric) --name(String) --text(String) (String)=value (Numeric)=index (Boolean)=success
輸入
Script | 設計工具 | 必要 | AcceptedTypes | 說明 |
---|---|---|---|---|
--culture | 語言 | 必要 | 文化特性 | 插入於文字 參數和資料來源 中文字的語言。 選項為: |
-- source | 資料來源 | 必要 | LookupOptions | 與插入於文字 參數中的文字相互比較的資料來源。 選項為: |
--algorithm | 演算法 | 必要 | TextSearchAlgorithms | 用來搜尋和比較指定的資料來源 中文字的演算法。 選項為: |
--soundexalgorithm | 聲音編碼演算法 | 僅 whenAlgorithm 為聲音編碼 | SoundExAlgorithms | 用來搜尋指定的資料來源中文字的「聲音編碼」演算法。 有下列選項: |
--fuzzyalgorithm | 模糊演算法 | 僅 whenAlgorithm 為模糊 | FuzzyStringComparisonAlgorithms | 「模糊」演算法是用來搜尋指定的資料來源 中的文字,選項如下: |
--tolerance | 允差 | 僅 whenAlgorithm 為模糊 | FuzzyStringComparisonTolerance | 使用資料來源 參數中的文字相似度來插入文字 參數中。 選項為:此參數是用來與定義的模糊 類型一起使用以執行搜尋。 |
--sourceCollection | 文字集合 | 僅 whenData 來源為集合 | ICollection<Text> | 將會在其中提取插入於文字 參數中文字的集合。 |
--sourcedatatable | 資料表 | 僅 whenData 來源為資料表 | 資料表 | 在其中提取文字 的資料表。 |
--usecolumnname | 使用直欄名稱 | 選用項目 | 布林值 | 啟用時,它會容許直欄名稱當作參照使用來搜尋插入於文字 參數中的文字。 |
-- index | 索引 | 僅 whenUse 直欄名稱為 "False" | 數字 | 將會在其中搜尋插入於文字 參數中文字的對應於資料表列的索引。 |
-- name | 名稱 | 僅 whenUse 直欄名稱為 "True" | 文字 | 會在其中提取文字 的資料表中的直欄名稱。 |
-- text | 文字 | 必要 | 文字 | 要在資料來源 中搜尋的文字。 |
輸出
Script | 設計工具 | AcceptedTypes | 說明 |
---|---|---|---|
值 | 找到的文字 | 文字 | 傳回在資料來源 中找到的文字。 |
索引 | 索引 | 數字 | 傳回指定的文字 會在資料來源 中找到的位置。 |
成功 | 順利完成 | 布林值 | 若在資料來源 找到文字 參數的文字會傳回 "True",否則會傳回 "False"。 |
範例
使用聲音編碼 演算法的選項 Fonetico,將語言設為葡萄牙文(巴西) 來搜尋文字集合 中的 "Text" 一字。 此外, 記載訊息 指令會在 IBM RPA Studio 主控台上登錄輸出參數 Index、 Success 及 Text Found 的傳回。
defVar --name textList --type List --innertype String --value "[Example,Text,Collection]"
defVar --name foundText --type String
defVar --name textIndex --type Numeric
defVar --name executionResult --type Boolean
lookupCommand --culture pt-BR --source "Collection" --algorithm "Soundex" --soundexalgorithm "Fonetico" --sourceCollection ${textList} --text Text foundText=value textIndex=index executionResult=success
logMessage --message "Text: ${foundText}\r\nIndex: ${textIndex}\r\nResult: ${executionResult}" --type "Info"
// Text: Text
// Index: 2
// Result: True
備註
在這個現行版本的 IBM RPA Studio中,不支援使用 英文 (美國) 或 葡萄牙文 (葡萄牙)指定的指令。 未來版本將會提供支援。