> For the complete documentation index, see [llms.txt](https://viewzenlabsug.gitbook.io/userguides/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://viewzenlabsug.gitbook.io/userguides/appverse/apps/create-an-app/forms/create/get-familiar/appverse-expressions/examples.md).

# Examples

Some example of calculation expressions are as under

| Required Calculation                   | Expression                                                                                                                                                                                  |
| -------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| No of days to today                    | today() - ${start\_start}                                                                                                                                                                   |
| Sum of three numbers                   | ${number1} + ${number2} + ${number3}                                                                                                                                                        |
| Average of three numbers               | (${number1} + ${number2} + ${number3}) div 3                                                                                                                                                |
| First 3 characters of a string         | substr(${string}, 0, 3)                                                                                                                                                                     |
| Length of a string                     | string-length(${string})                                                                                                                                                                    |
| Weighted average of two numbers        | (${number1}\*${weight1} + ${number2}\*${weight2}) div (${weight1} + ${weight2})                                                                                                             |
| Add 30 days to a given date            | date(${my\_date} + 30)                                                                                                                                                                      |
| Maximum of two numbers                 | max(${number1}, ${number2})                                                                                                                                                                 |
| Get string 'Even' or 'Odd' of a number | if(${number} mod 2 = 0, 'Even', 'Odd')                                                                                                                                                      |
| Calculate age from date of birth       | int((today() - ${dob}) div 365.25)                                                                                                                                                          |
| Nested if                              | if(${number} < 5, 'Less than 5', if(${number} >= 5 and ${number} <= 10, 'Between 5 and 10',  if(${number} > 10 and ${number} < 25, 'Greater than 10 and less than 25', 'Greater than 25'))) |
| Check if date is Saturday or Sunday    | if(format-date(${my\_date}, '%a') = 'Sat' or format-date(${my\_date}, '%a') = 'Sun', 'Weekend', 'Weekday')                                                                                  |
| Leap year                              | if(${my\_year} mod 400 = 0 or (${my\_year} mod 4 = 0 and ${my\_year} mod 100 != 0), 'Leap Year', 'Not a Leap Year')                                                                         |
|                                        |                                                                                                                                                                                             |


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://viewzenlabsug.gitbook.io/userguides/appverse/apps/create-an-app/forms/create/get-familiar/appverse-expressions/examples.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
