# Smart Fields

![](https://tawk.link/61dd64c2b84f7301d32a6e5b/kb/attachments/IEZauU_yH6.png)

### Smart Fields to calculate values

```
Labor: {labor} USD
Parts: {parts} USD
Total: {$ labor + parts} USD
Total + Tax: {$ (labor + parts) * 1.22}
```

You can use smart field to do simple and advanced calculations based on provided user form input.

> Make sure that you pick “NumberField” in form customization to prevent users from using text instead of numbers for fields that you want use for your calculations.

### Smart Fields Numbers vs Strings

If you want to accept strings and convert them into numbers for further calculations (useful if you integrate with the external system) you can use the special syntax within smart fields like : +\[fieldname]. Example:

```
Assuming:
field1: "2",
field2: "5"
field3: 2,
field4: 5

{$ field1 + field2 } ==> 25
{$ field3 + field4 } ==> 7

{$ +field1 + +field2 } ==> 7 
// Converts "2" into Number 2 and "5" into 5
```

### Use Special Filters to modify results

Smart Fields for conditions

You can use conditions to output element based on value provided from different field (from user)

General Condition Schema:

```
{$ [CONDITION] ? [TEXTIFTRUE] : [TEXTIFFALSE]}
```

Examples:

```
{$ FIELDNAME == 'VALUETOCOMPARE' ? 'textIfTrue' : 'textIfFalse'}
{$ FIELDNAME != 'VALUETOCOMPARE' ? 'textIfTrue' : 'textIfFalse'}
{$ FIELDNAME > NUMBERTOCOMPARE ? 'textIfTrue' : 'textIfFalse'}
{$ FIELDNAME < NUMBERTOCOMPARE ? 'textIfTrue' : 'textIfFalse'}
```

Supported operators:

```
== (Equal),
!= (Not Equal),
> (More Than)
< (Less Than)
&& (And)
|| (OR)
```

Example #1

```
Name: {name}
Surname: {surname}
Sex: {sex}
Full Name: {$ sex == 'woman' ? 'Mrs.' : 'Mr.'} {name} {surname}
```

Example #2

```
Name: {name}
Age: {age}
Status: {$ age > 18 ? 'Adult' : 'Underage'}
```

### Special Smart Fields

#### Show Current Time & Current Date with Format & Timezone

You can display current time or date using special smart field.

It supports two optional parameters:

**{$currentDate | date:'\[format]':'\[timezone]':'\[style]'}**

**{$currentTime | date:'\[format]':'\[timezone]'}**

**format \[optional]** - output format using language code - Examples: en-US, en-GB, fr-FR, de-DE, pl-PL, es-ES, it-IT | **Default: 'en-US'**

**timezone \[optional]** - timezone in IANA format - Examples:  America/Chicago, Europe/Berlin, Europe/Warsaw, Europe/Rome | **Default: 'UTC' UTC Timezone**\
\
See list of Available Timezones:

<https://en.wikipedia.org/wiki/List_of_tz_database_time_zones>

**style \[optional]** - date display style | **Default: Auto selected - depends on "format"**

```
'full', 'long', 'medium', 'short'
```

If incorrect format / timezone will be provided Documentero will use default values.

```
Examples for time:
{$currentTime} ---> 6:57:14 PM 
{$currentTime | time:'en-US'} --->  6:57:14 PM 
{$currentTime | time:'de-DE'} --->  18:57:14 
{$currentTime | time:'de-DE:'Europe/Berlin'} --->  20:57:14 
{$currentTime | time:'de-DE:'America/Chicago'} --->  13:57:14 
{$currentTime | time:'de-DE:'America/New_York'} --->  14:57:14 
{$currentTime | time:'en-US:'America/Chicago'} --->  1:57:14 PM
{$currentTime | time:'en-US:'America/New_York'} --->  2:57:14 PM

Examples for date:
{$currentDate} ---> 4/28/2023
{$currentDate | date:'en-US'} --->  4/28/2023 
{$currentDate | date:'de-DE'} --->  28.4.2023 
{$currentDate | date:'de-DE':'Europe/Berlin'} --->  28.4.2023
{$currentDate | date:'de-DE':'Pacific/Pago_Pago'} --->  27.4.2023 (Timezone can affect date)
​{$currentDate | date:'de-DE':'Pacific/Kiritimati'} ---> 29.4.2023 (Timezone can affect date)

{$currentDate | date:'en-US':'UTC'} ---> 5/8/2025
{$currentDate | date:'en-US':'UTC':'short'} ---> 5/8/25
{$currentDate | date:'en-US':'UTC':'medium'} ---> May 8, 2025
{$currentDate | date:'en-US':'UTC':'long'} ---> May 8, 2025
{$currentDate | date:'en-US':'UTC':'full'} ---> Thursday, May 8, 2025

{$currentDate | date:'de-DE':'UTC'} ---> 8.5.2025
{$currentDate | date:'de-DE':'UTC':'short'} ---> 08.05.25
{$currentDate | date:'de-DE':'UTC':'medium'} ---> 08.05.2025
{$currentDate | date:'de-DE':'UTC':'long'} ---> 8. Mai 2025
{$currentDate | date:'de-DE':'UTC':'full'} ---> Donnerstag, 8. Mai 2025


// Use addDays on currentDate
{$currentDate | addDays:3 | date:'en-US'} --->  Adds 3 days to currentDate and use'en-US' format
{$currentDate | addDays:7 | date:'de-DE'} --->  Adds 7 days to currentDate and use'de-DE' format
```


---

# Agent Instructions: 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://docs.documentero.com/documentation/templates/smart-fields.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.
