Advanced Modifiers
Data Mapping using a second version of mapping method.
ADVANCED MODIFIERS
Advanced Modifiers indicate a secondary and more developer-friendly approach to modify data.
There are two accepted formats for using advanced modifiers:
- Format 1 (Keyword arguments): Specifying parameter names while passing values
Example:
ARRAY_APPEND([1,2,3], element=5) (or)
ARRAY_APPEND(source=[1,2,3], element=5)
- Format 2: Without mentioning parameter names
Example:
ARRAY_APPEND([1,2,3], 5)
Note:
String must be passed by enclosing the data in single or double quotes.
GROUP and EXPRESSION are deprecated.
DESCRIPTION
Adds an element at the end of the array.
Note: If source is not a list, it returns source.
SYNTAX
ARRAY_APPEND(source*,element*)
PARAMETER
Name | Type | Description |
source | list | Source field - array in which elements are to be appended |
element | any | Element to be added at the end of source list |
EXAMPLE
Source Data | Expression | Output |
menu = ["chocolates","biscuits"] | ARRAY_APPEND(menu,"cakes") | ["chocolates","biscuits","cakes"] |
DESCRIPTION
Returns extended list if source and element are lists, else appends the element to the list.
SYNTAX
ARRAY_EXTEND(source*,element*,default)
PARAMETER
Name | Type | Description |
source | list | Source field - array which is to be extended |
element | list/ int/ float/ dictionary/ string | Element to be extended to the source list |
default | string | Default value: "NOT_IN_SOURCE" |
EXAMPLES
Source Data | Expression | Output |
menu = ["chocolates","biscuits"] new_items = ["cakes","ice creams"] | ARRAY_EXTEND(menu,element=new_items) | ["chocolates","biscuits","cakes","ice creams"] |
menu="chocolates" new_items =["cakes","ice creams"] | ARRAY_EXTEND(menu,new_items) | ["chocolates","cakes","ice creams"] |
DESCRIPTION
Adds an element at the specified index of the list. If the index is not mentioned, the element is added at the zeroth index.
SYNTAX
ARRAY_INSERT(source*,element*,index)
PARAMETER
Name | Type | Description |
source | list | Source field - array in which element has to be inserted |
element | any | Element to be inserted in the list |
index | integer | Index at which the element has to be inserted. Default value: 0 |
EXAMPLES
Source Data | Expression | Output |
menu = ["chocolates","biscuits"] | ARRAY_INSERT(menu,"cakes",1) | ["chocolates","cakes","biscuits"] |
menu = ["chocolates","biscuits"] | ARRAY_INSERT(menu,"cakes") | ["cakes","chocolates","biscuits"] |
DESCRIPTION
Returns a list containing the input.
Note: ignore_none must be used only as a keyword argument
SYNTAX
ARRAY_PUSH(args*,ignore_none)
PARAMETER
Name | Type | Description |
args | any | n source fields (n>=1) Data to be pushed into list |
ignore_none | boolean | Indicates whether None should be taken into account or not |
EXAMPLES
Source Data | Expression | Output |
company="DCKAP" | ARRAY_PUSH(company) | ["DCKAP"] |
company="DCKAP" product="INTEGRATOR" | ARRAY_PUSH(company,product) | ["DCKAP","INTEGRATOR"] |
company="DCKAP" product="INTEGRATOR" | ARRAY_PUSH(company,product,sample) | ["DCKAP","INTEGRATOR","NOT_IN_SOURCE"] |
company="DCKAP" product="INTEGRATOR" | ARRAY_PUSH(company,product,sample,ignore_none=True) | ["DCKAP","INTEGRATOR"] |
DESCRIPTION
Returns the list after removing the element if the element is mentioned.
(i) If index is only mentioned,
- Returns the list after removing the element at the specified index if it is a valid index.
- Returns source if the index is out of range.
(ii) If element is only mentioned,
- Returns the list after removing the element mentioned if the element is present in the list.
- Returns source if the element is not in the list.
(iii) If both element and index are mentioned,
- Returns the list after removing the specified element if present (ignoring the index).
- Returns source if the specified element is not in the list.
(iv) If both element and index are not mentioned,
- Returns the list after removing the element at zeroth index.
(v) If source is not a list,
- Returns source.
SYNTAX
ARRAY_REMOVE(source*,element,index)
​
PARAMETER
Name | Type | Description |
source | list | Source field - array from which element has to be removed |
element | any | Element to be removed |
index | int | Index of the element to be removed |
EXAMPLES
Source Data | Expression | Output |
item_ids=[1001,1002,1003,1004] | ARRAY_REMOVE(item_ids,1003) | [1001,1002,1004] |
item_ids=[1001,1002,1003,1004] | ARRAY_REMOVE(item_ids,index=2) | [1001,1002,1004] |
item_ids=[1001,1002,1003,1004] | ARRAY_REMOVE(item_ids,2) | [1001,1002,1003,1004] |
item_ids=[1001,1002,1003,1004] | ARRAY_REMOVE(item_ids) | [1002,1003,1004] |
item_ids=[1001,1002,1003,1004] | ARRAY_REMOVE(item_ids,1001,3) | [1002,1003,1004] |
item_ids=[1001,1002,1003,1004] | ARRAY_REMOVE(item_ids,1005) | [1001,1002,1003,1004] |
DESCRIPTION
Returns string with the first character of the string converted to capital (uppercase) letter while making all other characters in the string as lowercase letters.
Note: Returns source if source is not a string
SYNTAX
CAPITALIZE(source*)
PARAMETER
Name | Type | Description |
source | string | Source field - data to capitalize |
EXAMPLE
Source Data | Expression | Output |
name="ironman" | CAPITALIZE(name) | "Ironman" |
DESCRIPTION
Returns a string by joining the user inputs (with the mentioned join character, if any).
Note: join_chars must be used only as keyword argument
SYNTAX
CONCATENATE(args*,join_chars)
PARAMETER
Name | Type | Description |
args* | string | n source fields (n>=1) Fields to be joined |
join_chars | string | The string that must appear between the sources when the source fields are joined.
Default Value: '' |
EXAMPLES
Source Data | Expression | Output |
name="integrator" connector="@" domain ="dckap.com" | CONCATENATE(name,connector,domain) | |
first_name="Iron" last_name="Man" | CONCATENATE(first_name,last_name,join_chars=" ") | "Iron Man" |
DESCRIPTION
Converts time from 12 hrs format to 24 hrs format and vice versa
SYNTAX
CONVERT_TIME(source*)
PARAMETER
Name | Type | Description |
source | string | Source Field - time to be converted |
EXAMPLES
Source Data | Expression | Output |
created_at='11:37:00 pm' | CONVERT_TIME(created_at) | "23:37:00" |
created_at='23:37:00' | CONVERT_TIME(created_at) | "11:37:00 PM" |
DESCRIPTION
Looks for source in keys of converters dictionary and returns the corresponding value.
SYNTAX
CONVERTER(source*,converters*)
PARAMETER
Name | Type | Description |
source | string | Source field - key which needs to be replaced with value from converters dictionary |
converters (editable key-value pair icon) | dictionary | Reference dictionary from which the value of source is to be retrieved |
EXAMPLES
Source Data | Converters | Expression | Output |
country="United States" | {"India":"+91","United States":"+1"} | CONVERTER(country,converters) | "+1" |
country="United Kingdom" | {"India":"+91","United States":"+1"} | CONVERTER(country,converters) | "NOT_IN_SOURCE" |
country="United Kingdom" | {"India":"+91","United States":"+1","__default__":"Data Not Available"} | CONVERTER(country,converters) | "Data Not Available" |
DESCRIPTION
Returns the length of source;
Returns zero, if the source is of invalid datatype.
SYNTAX
COUNT(source*)
PARAMETER
Name | Type | Description |
source | string/list/dictionary | Source field for which length has to be calculated |
EXAMPLES
Source Data | Expression | Output |
items=[100,200,300] | COUNT(items) | 3 |
country_codes={"India":"+91","United States":"+1"} | COUNT(country_codes) | 2 |
DESCRIPTION
Converts the input to requested datatype
SYNTAX
DATATYPE_CONVERTER(source*,datatype)
PARAMETER
Name | Type | Description |
source | any | Source field which has to be converted |
datatype | int,float,boolean,list,dict | Datatype to which source has to be converted. Can be provided with quotes like 'int'. |
EXAMPLES
Source Data | Expression | Output |
country_codes={"India":"+91","United States":"+1"} | DATATYPE_CONVERTER(country_codes,’list’) | ["India","United States"] |
price=100.123 | DATATYPE_CONVERTER(price,int) | 100 |
DESCRIPTION
Formats the datetime (object or string) to user specified string date format.
SYNTAX
DATETIME_FORMATTER(source*,requested_format,default)
PARAMETER
Name | Type | Description |
source | Datetime object/ string | Source field to be converted into the requested format |
requested_format | string | Desired format of time |
default | ​ | ​ |
EXAMPLE
Source Data | Expression | Output |
created_at='Sat, 27 Jan 2018 17:16:55 +0000' | DATETIME_FORMATTER(created_at,'%Y-%m-%d %I:%M:%S %p') | '2018-01-27 05:16:55 PM' |
DESCRIPTION
Decodes the encoded string (codec registry)
SYNTAX
DECODE(source*)
PARAMETER
Name | Type | Description |
source | bytes | Source field - bytes data to be decoded |
EXAMPLE
Source Data | Expression | Output |
secret=b'St\xc3\xa5le' | DECODE(secret) | 'Ståle' |
DESCRIPTION
Returns the email address if valid, else default
SYNTAX
EMAIL_VALIDATOR(source*,default)
PARAMETER
Name | Type | Description |
source | string | Source field - email to be validated |
default | string | Value to display if email is invalid Default value: "NOT_IN_SOURCE" |
EXAMPLES
Source Data | Expression | Output |
contact_mail="[email protected]" | EMAIL_VALIDATOR(contact_email) | |
contact_mail="integrator" | EMAIL_VALIDATOR(contact_email) | "NOT_IN_SOURCE" |
contact_mail="integrator" | EMAIL_VALIDATOR(contact_email,"Invalid email") | "Invalid email" |
DESCRIPTION
Encodes the string (codec registry)
SYNTAX
ENCODE(source)
PARAMETER
Name | Type | Description |
source | string | Source field to be encoded |
EXAMPLE
Source Data | Expression | Output |
secret='Ståle' | ENCODE(secret) | b'St\xc3\xa5le' |
DESCRIPTION
Returns true if the string ends with the mentioned suffix in the specified index range else False. Returns false if source is not a string.
SYNTAX
ENDSWITH(source*,suffix*,start,end)
PARAMETER
Name | Type | Description |
source | string | Source field |
suffix | string | Suffix string with which the check on source has to be made. |
start | integer | Start index of the string |
end | integer | End index of the string |
EXAMPLES
Source Data | Expression | Output |
message="Great Day" | ENDSWITH(message,"ay") | true |
message="Great Day" | ENDSWITH(message,"ay",1,5) | false |
DESCRIPTION
For the given source dictionary,
Returns result_key if the value of find_key is check_value.
Returns default otherwise.
SYNTAX
FIND_AND_MATCH(source*,find_key*,check_value*,result_key*,default)
PARAMETER
Name | Type | Description |
source | dictionary | Source field |
find_key | string | Key to search in source dictionary |
check_value | any | Value to check for find_key |
result_key | string | Key whose value is to be returned as result |
default | string | String to display in absence of find_key or result_key or a different check_value Default Value: "NOT_IN_SOURCE" |
EXAMPLES
Source Data | Expression | Output |
signatures= {"Subject":"Request", "Sign":"Sincerely"} | FIND_AND_MATCH(signatures,"Subject",'Request','Sign') | "Sincerely" |
signatures= {"Subject":"Request", "Sign":"Sincerely"} | FIND_AND_MATCH(signatures,"Subject",'Friend','Sign','Data not available') | "Data not available" |
DESCRIPTION
If the condition is satisfied, it executes on_success, else runs on_fail.
SYNTAX
IFELSE(condition,on_success,on_fail)
PARAMETER
Name | Type | Description |
condition | field/another expression | Field or expression to be checked for some value |
on_success | field/another expression | If value exists, field/expression to be returned |
on_fail | field/another expression | If value does not exist, field/expression to be returned |
EXAMPLES
Source Data | Expression | Output |
company_name='DCKAP' | IFELSE(company_name,company_name,'INTEGRATOR') | "DCKAP" |
first_name="Iron" last_name="Man" | IFELSE(company_name,company_name,CONCATENATE(first_name,last_name),join_chars=" ") | "Iron Man" |
IFELSE supports additional capabilities to check conditions with the operators <, <=, >, >=, ==, !=
Examples:
IFELSE(AGE>=18,"Yes","No")
IFELSE(COUNT('ABC')>=COUNT(LSTRIP(" ABC")),UPPER(first_name),"No Name")
DESCRIPTION
Returns string after removing Unicode characters.
Returns source if the source is not a string.
SYNTAX
IGNORE_ASCII(source*)
PARAMETER
Name | Type | Description |
source | string | Source field from which Unicode characters are to be removed |
EXAMPLE
Source Data | Expression | Output |
name='Å koda' | IGNORE_ASCII(name) | 'koda' |
DESCRIPTION
For string, returns true if all the alphabets are lowercase(a-z) else returns false.
Note: If source is not a string, return false.
SYNTAX
ISLOWER(source*)
PARAMETER
Name | Type | Description |
source | string | Source field which is to be checked |
EXAMPLE
Source Data | Expression | Output |
category="chocolate" | ISLOWER(category) | true |
DESCRIPTION
For string, returns true if all the alphabets are uppercase(A-Z) else returns false.
If source is not a string, it returns false.
SYNTAX
ISUPPER(source*)
PARAMETER
Name | Type | Description |
source | string | Source field which is to be checked |
EXAMPLE
Source Data | Expression | Output |
category="chocolate" | ISUPPER(category) | false |
DESCRIPTION
Left aligns the string, using a specified character (space is default) as the fill character for making the length of the output string as the mentioned width.
Note: Returns source, if source is not a string.
SYNTAX
LJUST(source*,width*,fillchar)
PARAMETER
Name | Type | Description |
source | string | Source Field |
width | integer | Length of the output |
fillchar | string | String to make the text to the desired width and left justified Default value:' ' |
EXAMPLES
Source Data | Expression | Output |
message='hello' | LJUST(message,10) | 'hello ' |
message='hello' |