> For the complete documentation index, see [llms.txt](https://doc.duaer.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://doc.duaer.com/code/builtin/convenience.md).

# Use convenience methods in Duaer expressions

In a Duaer expression, use $json for the current item, $("Node name") for an earlier node, and $now and $if() for time and conditions.
## The current item and earlier nodes

- $json is the current item. $json.city is the city field.
- $binary is the file on the current item.
- $("Node name").first() is that node’s first item. last() is the last. all() is every item.
- $("Node name").item is the item linked to the current output. Linking is in [How items stay linked through a run](/data/data-mapping/data-item-linking.md).
- $itemIndex is this item’s position in the batch, starting at 0. $runIndex is how many times this node has run, also from 0.
- $prevNode.name, $prevNode.outputIndex, and $prevNode.runIndex describe the node immediately before this one.

## Time, conditions, and empty values

- $now is the current date and time. $today is today. Format with $now.toFormat("yyyy-MM-dd"). Details are in [Work with dates using Luxon in Duaer](/code/cookbook/luxon.md).
- $if(condition, valueIfTrue, valueIfFalse) picks a value. The ternary condition ? a : b works too.
- $ifEmpty(value, defaultValue) returns the default when the value is undefined, null, an empty string, an empty array, or an empty object.

```
{{ $ifEmpty($json.city, "unknown") }}
```

## This execution, this workflow, and variables

- $execution.id is this execution’s id. $execution.mode says whether the run was manual or started by a live trigger. $execution.customData reads and writes custom execution data.
- $workflow.id, $workflow.name, and $workflow.active are this workflow’s id, name, and whether it is active.
- $vars.key reads [Define custom variables in Duaer](/code/variables.md).
## Questions

### Which values does $ifEmpty treat as empty in Duaer?

In a Duaer expression, $ifEmpty(value, default) returns the default for undefined, null, an empty string, an empty array, or an object with no fields. Any other value is returned as it is.

### How do you format the current time in Duaer?

In a Duaer expression, $now is the current time and $today is today. Write {{ $now.toFormat("yyyy-MM-dd") }}.

## Related

- [Use built-in methods and variables in Duaer](https://doc.duaer.com/code/builtin.md)
- [Transform data with expressions in Duaer](https://doc.duaer.com/code/expressions.md)
- [Work with dates using Luxon in Duaer](https://doc.duaer.com/code/cookbook/luxon.md)

