How to write Custom Processing for each label?

Created by Vishal Arya, Modified on Wed, 26 Jul, 2023 at 3:21 PM by Vishal Arya

We allow users to add custom processing along with a predefined list provided in the general tab.



Custom Processing:-



Important

  1. 'self' is replaced with a label name.
  2. No space between any function
  3. You can also combine function like UPPER(LEFT("docsumo",3))Supported Functions
    Function Name
    LEFTReturns the leftmost characters from a text value=LEFT("docsumo",3)
    RIGHTReturns the leftmost characters from a text value=RIGHT("docsumo",4)
    SUMSum of all the valuesd = {'a':1, 'b':4, 'self':5} =SUM('a', 'b')>5
    =SUM('self')>5
    SEARCHINLISTSearch the value in list provided SEARCHINLIST(text, text_to_search_with_separator, separator)=SEARCHINLIST("hi" , "hi,hello", ",")
    =SEARCHINLIST("bye" , "hi,hello", ",")
    REMOVEFROMLISTRemove words if in list REMOVEFROMLIST(text, text_to_search_with_separator, separator)=REMOVEFROMLIST("hi world" , "hi,hello", ",")
    GETDATAURLGet 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"
    FINDANDREPLACERemove word from string FINDANDREPLACE(text, list, replacing_str, separator, strict)=FINDANDREPLACE("hi hello world namaste", "hello, world", "apple,mango", ",", 1)
    PARSEADDRESSParse 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"
    IFWrite 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
    DELTADATECompare 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
    MAKELISTMAKELIST(str)
    Get value as list on webhook or api response.
    MAKELIST('self')
    MAKELIST("abc123") => ["abc123"]
    MAKELIST("abc123\ndef456") => ["abc123","def456"]
    TABLEOPERATORTABLEOPERATOR("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")
    PARSETELNUMBERPARSETELNUMBER("string")
    Formula to extract US telephone number form any string
    PARSETELNUMBER("phone number: 1-1234.234-2323") => 1-1234-234-2323
    CONVERTTONUMBERCONVERTTONUMBER("str")
    Formula to extract number from any string
    CONVERTTONUMBER("Amount: 5500") => 5500
    CONVERTTODATECONVERTTODATE("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
    CONVERTTOBOOLCONVERTTOBOOL("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
    CSVOPERATORCSVOPERATOR(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)")
    SHIFTDATEUsed 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"


    Get a dropdown from URL

    You can add a dropdown from URL.

    The output should be a list. E.g ["invoice", "bank statement"]



url,header,data,postprocessing,method
E.g: https://appdocsumo.com/api/v1/eevee/apikey/limit/,X-API-KEY:Ckypp36YES,,data.document_types.loop__title,GET
> ["invoice", "pan", "bs"]

Detail
- url: str
    - Eg: *https://apptesting.docsumo.com/api/v1/eevee/apikey/limit/*
- header: str
    - Eg: *X-API-Key:asdf1234*
- data: dict
- postprocessing: str
    - get required datas from response of **url**
        Let: response = 
        {data: {document_types:[{"title":"TITLE1","value":"VALUE1"},{"title":"TITLE2", "value":"VALUE2"}]}}
    - to get all titles
        Eg: *data.document_types.loop_title*
        Output: ["TITLE1", "TITLE2"]
    - use .loop_ to loop through lists or [int]. to get data from specific index
        Eg: *data.document_types.1.title*
        Output: "TITLE2"
- method: str
    - only GET and POST methods are allowed


Happy Annotating!

Was this article helpful?

That’s Great!

Thank you for your feedback

Sorry! We couldn't be helpful

Thank you for your feedback

Let us know how can we improve this article!

Select at least one of the reasons
CAPTCHA verification is required.

Feedback sent

We appreciate your effort and will try to fix the article