Custom Field Processing

Custom Field Processing in Docsumo provides you with the flexibility to manipulate extracted data as per your specific requirements. It allows you to apply custom logic to extracted values, ensuring they meet your data format or quality standards. Here's how to use custom processing for fields:

Steps to Use Custom Field Processing:

Step 1: Access Edit Fields Page:

  • Start by navigating to the "Edit Fields" page within Docsumo for the relevant document type.

Step 2: Locate the Field:

  • Find the field for which you want to apply custom processing.

Step 3: Access Field Settings:

  • Click on the "Settings" button from the dropdown of the 3 dots menu

Step 4: Navigate to Custom Post Processing:

  • In the menu that appears, click on advanced tab and scroll down to the bottom of the popup to find "Custom Post Processing".

Step 5: Apply Custom Logic:

  • In the "Custom Processing" block, you can define your custom logic using pre defined functions or rules to manipulate the extracted data as needed. For instance, you can create a custom rule to round numbers to a specific decimal place.

    The functions which you can use are:

    Name

    Description

    Function

    LEFT

    Returns the leftmost characters from a text value

    =LEFT("docsumo",3)

    RIGHT

    Returns the leftmost characters from a text value

    =RIGHT("docsumo",4)

    SUM

    Sum of all the values

    d = {'a':1, 'b':4, 'self':5} =SUM('a', 'b')>5
    =SUM('self')>5

    SEARCHINLIST

    Search the value in list provided SEARCHINLIST(text, text_to_search_with_separator, separator)

    =SEARCHINLIST("hi" , "hi,hello", ",")
    =SEARCHINLIST("bye" , "hi,hello", ",")

    REMOVEFROMLIST

    Remove words if in list REMOVEFROMLIST(text, text_to_search_with_separator, separator)

    =REMOVEFROMLIST("hi world" , "hi,hello", ",")

    GETDATAURL

    Get value from url GETDATAURL("URL,AUTH,DATA, POST_PROESSING,METHOD")

    =GETDATAURL("https://app.docsumo.com/api/v1/eevee/apikey/limit/,X-API-KEY:1234,,,GET%22)

    "value"

    FINDANDREPLACE

    Remove word from string FINDANDREPLACE(text, list, replacing_str, separator, strict)

    =FINDANDREPLACE("hi hello world namaste", "hello, world", "apple,mango", ",", 1)

    PARSEADDRESS

    Parse any USA address into into its component parts, like a street number, street name, suffix, and others

    =PARSEADDRESS("687 NW. Woodsman St. Wheaton, IL 60187")

    {"AddressNumber": "687", "StreetNamePreDirectional": "NW.",
    "StreetName": "Woodsman", "StreetNamePostType": "St.",
    "PlaceName": "Wheaton", "StateName": "IL",
    "ZipCode": "60187"}

    =PARSEADDRESS("687 NW. Woodsman St. Wheaton, IL 60187", "AddressNumber")

    "687"

    IF

    Write complete if and else logic. You can also nest the IF similar to excel. IF(condition, True_value, False_value)

    = IF(LEN('self')>5, "this is good", "this is bad") {"self": "IN1234567"}

    this is good

    DELTADATE

    Compare two dates to find if range falls within given interval.

    DELTADATE(date1, date2, interval: defaults 30, format: defaults "dd/mm/yyyy", available: "mm/dd/yyyy" )

    DELTADATE("12/12/2020","15/12/2020",1,"dd/mm/yyyy") > False

    DELTADATE("12/12/2020","15/12/2020",10,"dd/mm/yyyy") > True

    MAKELIST

    MAKELIST(str)
    Get value as list on webhook or api response.

    MAKELIST('self')
    MAKELIST("abc123") => ["abc123"]
    MAKELIST("abc123\ndef456") => ["abc123","def456"]

    TABLEOPERATOR

    TABLEOPERATOR("tablename, operator")
    tablename is combination of section name, table name and column name with format: section_name**_table_name**column_name
    operator=any of the sum, count or avg

    TABLEOPERATOR("Table SectionTable 1Amount, sum")
    TABLEOPERATOR("Table SectionTable 1Amount, count")
    TABLEOPERATOR("Table SectionTable 1Amount, avg")

    PARSETELNUMBER

    PARSETELNUMBER("string")
    Formula to extract US telephone number form any string

    PARSETELNUMBER("phone number: 1-1234.234-2323") => 1-1234-234-2323

    CONVERTTONUMBER

    CONVERTTONUMBER("str")
    Formula to extract number from any string

    CONVERTTONUMBER("Amount: 5500") => 5500

    CONVERTTODATE

    CONVERTTODATE("str",
    "required_format")
    Formula to extract date from any string to required_format

    "required_format": defaults "%d/%m/%Y"

    CONVERTTODATE("Date 2021/12/18","%m/%d/%Y") => 12/18/2021

    CONVERTTOBOOL

    CONVERTTOBOOL("str","true_values","false_values")
    Formula that returns True or False depending on if str is present on true_values or false_values

    "true_values": "yes,y,true,t,1"
    if str is any of above values, True is returned
    "false_values": "no,n,false,f,0"
    if str is any of above values, False is returned

    CONVERTTOBOOL('t') => True
    CONVERTTOBOOL('0') => False

    CSVOPERATOR

    CSVOPERATOR(OPERATOR, TABLE_NAME___COL_NAME, params)
    Use database table to perform various operation.

    "OPERATOR":

    • STP: pass document through STP when certain condition met
      "TABLE_NAME_COL_NAME": Database table name and column name separated by ___. If value is found in the specified column, depending on params OPERATOR is executed
      "params": (value to be compared, column name if another column value needs to be checked/fetched, default value (if required)

    CSVOPERATOR("STP,TABLE___COL, (self,COL1)")

    SHIFTDATE

    Used to add/subtract number of days from a given date.

    SHIFTDATE(date, days, source_format, output_format)

    date: Input date string
    days: Number of days to add or subtract from date . Days Can be positive or negative integer
    source_format: The format of the DATE. Can be dd/mm/yyyy or mm/dd/yyyy . Default dd/mm/yyyy
    output_format: The format of the result of SHIFTDATE. Can be dd/mm/yyyy or mm/dd/yyyy . Default dd/mm/yyyy

    SHIFTDATE("10/01/2023", 5) => "15/01/2023"

    SHIFTDATE("10/01/2023", -5) => "05/01/2023"

    CONVERTTOAMOUNT

    Removes character's and symbols from amount and returns amount with desired number of decimal places.

    CONVERTTOAMOUNT(value, number of decimal places, separator)

    amount : ( str or float ) Amount in string format
    decimal_places : ( int ) Number of decimal places to truncate or Pad. Default is None.
    separator : ( str ) There are two notations comma and dot for floating values. Default is dot notaion.

    CONVERTTOAMOUNT("123.55", 4, "dot") => 123.5500
    CONVERTTOAMOUNT("123.12345", 2, "dot") => 123.12

Step 6: Save & Extract:

  • After defining your logic, click validate to give it a check for any errorrs.
  • Click Save & Extract to apply the custom processing to the field.
📘

While creating a function, anything inside single quotes is taken as variable name and double quotes is taken as string

E.g: UPPER(LEFT("docsumo",3)) > "DOC"
E.g: UPPER(LEFT('self', 3)) > we expect self to pass data as {'self': "docsumo") > "DOC"

By following these steps, you can leverage custom field processing in Docsumo to tailor the extracted data to your specific requirements. This feature enhances data accuracy, consistency, and usability, ensuring that the extracted information aligns with your business needs.