# Inline Functions

The Adaptive Card Designer is great for formatting or doing complex calculations using in-line functions directly on the elements you have used to create your card. This could be a complex mathematical formula where the answer is dynamically calculated and displayed directly in a [**TextBlock**](/adaptive-cards/building-adaptive-cards/content-elements.md#textblock) or format a timestamp into an easier-to-read format as soon as the card is rendered. These inline functions follow the same principles from the [**Data Binding**](/adaptive-cards/data-binding.md) and/or the [**Conditional Rendering**](/adaptive-cards/conditional-rendering.md) sections.

{% hint style="info" %}
Note: As this follows the same principles as [**Data Binding**](/adaptive-cards/data-binding.md) and [**Conditional Rendering**](/adaptive-cards/conditional-rendering.md), it is highly recommended to implement these inline functions directly into the [**Card Payload Editor**](/adaptive-cards/building-adaptive-cards.md#card-payload-editor). This is the easiest approach.
{% endhint %}

There is a wide variety of Inline Functions available to use, [**see here**](https://learn.microsoft.com/en-us/azure/bot-service/adaptive-expressions/adaptive-expressions-prebuilt-functions?view=azure-bot-service-4.0).

## Format Timestamp Example

The following example will describe how to convert a date/timestamp from a `DD-MM-YYYY hh:mm:ss` format to a `YYYY-MM-DD` format as commonly seen in SAP. We can do all this using inline functions within the Adaptive Card Designer. Below is a sample JSON from a Looply Workflow:

```json
{
    "payload": {
        "output": {
            "date": "03/15/2018 12:00:00" // date to format
        },
        "description": "Request"
    }
}
```

Next is the Adaptive Card JSON which will format this date into `YYYY-MM-DD` format.

```json
{
    "type": "AdaptiveCard",
    "$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
    "body": [
        {
            "type": "TextBlock",
            "wrap": true,
            // inline function
            "text": "${formatDateTime($root.payload.output.date, 'yyyy-MM-dd')}"
        }
    ],
    "version": "1.5"
}
```

{% hint style="info" %}
Note: Different inline functions will require different parameters but will always be triggered the same if wrapped in `${}.`
{% endhint %}


---

# 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://academy.looply.ai/adaptive-cards/inline-functions.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.
