How to write Custom Processing for each label?
We allow users to add custom processing along with a predefined list provided in the general tab.
Custom Processing:-
Important
- 'self' is replaced with a label name.
- No space between any function
- You can also combine function like UPPER(LEFT("docsumo",3))
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"
Supported Functions
Function Name | ||
---|---|---|
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 integersource_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!
Updated 3 months ago