Table fields

Add scripts in Designer for table fields.

Procedure

  1. In IQ Bot Designer, left-hand panel, highlight Table/section settings for the table whose extraction/validation you aim to improve further.
  2. In the middle panel, scroll down to Logic.
  3. In the Logic section, toggle between fullscreen and smallscreen for ease of use.
  4. Add code to modify the extracted table values, which are stored as a Python dictionary in a user variable called table_values. See example below.
    Each row has a Guid (Global unique identifier), which allows IQ Bot to auto track rows that are added and deleted. If you add a row, you need not enter a Guid. IQ Bot will handle this automatically.
    
    # 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()
    
  5. Select Test Run to test your script and see the results before vs. after.
    
          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
    
    
  6. If you select See extraction results or save the bot, your script is saved.