Common use-cases of the Expression language
Using Filter and Iterate function Let's say you have an array of line items, where items can be of different type (e.g. "Food", "Drinks", etc...) and you need to get a SUM of a specific type. Then you can do it using a combination of filter and iterate function: % sum(iterate(filter( lineitems , 'type == "Drinks"'),'totalprice')) % Example JSON dataset:PopularDate functions
Date Format date value. Examples of the function "Date": Display current time Specify timezone Specify output format Specify output and input format Datetime Format datetime value.PopularFunctions
Number functions Format number Format a number with grouped thousands and optionally decimal digits. Round Round the float number based on the precision from the second parameter. Ceil Rounds to the nearest integer up. E.g. 2.1 =3. Floor Rounds to the nearest intPopularHow to access a specific array element?
It is possible to use expression language to access specific items in an array if a numeric keys are used. The array can contain strings, number or objects. Access array at index 1 Access array at index 1 and display value of "item" Example JSONPopularList (array) functions
Count It is possible to count number of items in list. Max Returns maximum value of list of elements or separate field values. or Min Returns minimum value of list of elements or separate field values. orPopularNumber Functions
Format number Format a number with grouped thousands and optionally decimal digits. Round Round the float number based on the precision from the second parameter. Ceil Rounds to the nearest integer up. E.g. 2.1 =3. Floor Rounds to the nearest integer down. E.g. 2.8 =>Some readersString functions
Uppercase To display data field value in uppercase, use following expression. Lowercase To display data field value in lowercase, use following expression. Capitalize Uppercase the first character of each word in a string. Split The split(delimiter, string) function allows to split string into an array.PopularSupported operators
Arithmetic Operators + (Addition) - (Subtraction) * (Multiplication) / (Division) % (Modulus) (Pow) Logical Operators ! (not) && (And) (Or)PopularUtility functions
Empty The empty(value) checks if the variable exists and if the value is not “falsy”. Returns true if var does not exist or has a value that is empty or equal to zero, aka falsely. Otherwise, it returns false. What qualifies as "falsy"? Anything that returns false if cast to boolean Empty array Zero as number Zero as string Empty string null false undefined JSON decode Decode JSON string to usPopularWhat is Expression Language?
Expression language in PDF Generator API is a specific programming language that allows writing mathematical and logical expression to manipulate the value displayed by component. Example expression Related articles you mayPopular
