表格欄位
在 Designer 中為表格欄位新增指令碼。
程序
- 在 IQ Bot Designer中,左側面板會針對您想進一步改進擷取/驗證的表格反白顯示 [表格/區段設定]。
- 在中間面板中,向下捲動至 [邏輯]。
- 在 [邏輯] 區段中,在 [全螢幕] 和 [小螢幕] 之間切換以便於使用。
-
新增程式碼以修改擷取的表格值,這些值在名為 table_Values 的使用者變數中儲存為 Python 字典。請參閱以下範例。
每一列都有 GUID (全域唯一識別碼),能讓 IQ Bot 自動追蹤新增和刪除的列。若新增一行,則無需輸入 GUID。IQ Bot 會自動處理。
# variable that stores the value: table_values # convert from dictionary to dataframe df = pd.DataFrame.from_dict(table_values) # print dataframe before update print(df) # Item_Description: drop rows with a missing value df = df[(df["Item_Description"] != "")] # Quantity: extract first part of the string, the numeric part only df['Quantity'] = df['Quantity'].str.split(' ', 1).str[0].str.strip() # print dataframe after update print(df) # convert back from dataframe to dict to override what IQ Bot stores table_values = df.to_dict()
-
選取 [測試執行] 以測試您的指令碼,並查看前後結果。
Item_Description Guid product_id Quantity Item_Total 0 wafer, NO172 43ea78f4-7b9b-413a-83ce-89d671478d6c 2 COMS5A-18090220 4.00 PCS 5,840.00 1 Visual Iaspection + cc774f5f-2507-4a15-8e45-7b2abf84fabe 1.00 EA 65.00 2 6bddfed1-2359-4305-a0ac-a1769c113bfb 5% VAT : Total - 4.00PCS GR: 5,905.00 3 2dc642a7-8e6e-4bc6-9672-85afff8c21db Total - KGD: 0.00 Item_Description Guid product_id Quantity Item_Total 0 wafer, NO172 43ea78f4-7b9b-413a-83ce-89d671478d6c 2 COMS5A-18090220 4.00 5,840.00 1 Visual Iaspection + cc774f5f-2507-4a15-8e45-7b2abf84fabe 1.00 65.00
- 您若選擇 [查看擷取結果] 或儲存 bot,則系統會儲存指令碼。