vsslasd
Feb 15, 2024Copper Contributor
Adaptive Card Calculation
We are trying to calculate the number of days between the from and to dates which may be overriden in the Total Days Requested text box in the following JSON:
What is the syntax formula, and how does that get inserted into the JSON Code?
Thank you
{
"type": "AdaptiveCard",
"body": [
{
"type": "Container",
"backgroundImage": {
"horizontalAlignment": "Center",
"verticalAlignment": "Center"
},
"minHeight": "200px",
"verticalContentAlignment": "Bottom",
"items": [
{
"type": "Image",
"url": "https://w.png",
"altText": "adsf"
},
{
"type": "ColumnSet",
"columns": [
{
"type": "Column",
"width": "400px",
"items": [
{
"type": "TextBlock",
"text": "PTO Request for: @{body('Parse_JSON')?['EEName']}",
"wrap": true,
"fontType": "Default",
"size": "Large"
},
{
"type": "TextBlock",
"text": "EEId: @{body('Parse_JSON')?['EEId']}",
"wrap": true,
"id": "EEId"
}
],
"style": "default"
}
]
}
],
"bleed": true,
"id": "hero"
},
{
"type": "Container",
"items": [
{
"type": "TextBlock",
"text": "Your current balances",
"wrap": true,
"weight": "Bolder"
},
{
"type": "TextBlock",
"text": " Available PTO: @{body('Parse_JSON')?['EEPTOAvail']}",
"wrap": true,
"$when": "${already_planned != ''}"
},
{
"type": "TextBlock",
"text": "🟡 Pending PTO: @{body('Parse_JSON')?['EEPTOPending']}",
"wrap": true
},
{
"type": "Container",
"items": [
{
"type": "ColumnSet",
"columns": [
{
"type": "Column",
"width": "stretch",
"items": [
{
"type": "TextBlock",
"text": "🟢 Adjusted PTO Total: @{variables('EEPTotal')}",
"wrap": true,
"size": "Medium",
"weight": "Bolder"
}
]
},
{
"type": "Column",
"width": "100px",
"items": [
{
"type": "TextBlock",
"text": " ",
"wrap": true,
"size": "Medium",
"weight": "Bolder"
}
],
"verticalContentAlignment": "Center",
"horizontalAlignment": "Right"
}
],
"$data": "${allowances}",
"spacing": "Medium"
}
],
"style": "emphasis",
"spacing": "Small"
},
{
"type": "ActionSet",
"actions": [
{
"type": "Action.ToggleVisibility",
"title": "Request PTO now",
"targetElements": [
"request-pto",
"hero",
"balances"
]
},
{
"type": "Action.ToggleVisibility",
"title": "Cancel",
"targetElements": [
"request-pto",
"hero",
"balances"
]
}
],
"horizontalAlignment": "Left",
"id": "toggle"
}
],
"id": "balances"
},
{
"type": "Container",
"style": "default",
"items": [
{
"type": "ColumnSet",
"columns": [
{
"type": "Column",
"width": "stretch",
"items": [
{
"type": "TextBlock",
"text": "From",
"wrap": true,
"size": "Small"
},
{
"type": "Input.Date",
"spacing": "None",
"id": "from-date"
}
]
},
{
"type": "Column",
"width": "stretch",
"items": [
{
"type": "TextBlock",
"text": "To",
"wrap": true,
"size": "Small",
"spacing": "Small"
},
{
"type": "Input.Date",
"spacing": "None",
"id": "to-date"
}
]
}
]
},
{
"type": "Input.Number",
"placeholder": "Total Days Requested",
"label": "Total Days Requested:",
"id": "EETotalDays"
},
{
"type": "TextBlock",
"text": "Type of PTO",
"wrap": true,
"size": "Small",
"spacing": "Small"
},
{
"type": "Input.ChoiceSet",
"choices": [
{
"title": "Annual Leave",
"value": "Choice 1"
},
{
"title": "Parental Leave",
"value": "Choice 2"
},
{
"title": "Compassionate Leave",
"value": "Choice 3"
},
{
"title": "Jury Duty",
"value": "Choice 4"
},
{
"title": "Sick Leave",
"value": "Choice 5"
}
],
"placeholder": "Placeholder text",
"spacing": "Small",
"id": "type-of-pto",
"style": "expanded"
},
{
"type": "TextBlock",
"text": "Comment",
"wrap": true,
"spacing": "Small",
"size": "Small"
},
{
"type": "Input.Text",
"placeholder": "Optional",
"spacing": "None",
"isMultiline": true,
"id": "comment"
},
{
"type": "ActionSet",
"actions": [
{
"type": "Action.Submit",
"title": "Submit PTO request",
"id": "_success_Your_PTO_request_was_submitted"
},
{
"type": "Action.ToggleVisibility",
"title": "Cancel",
"targetElements": [
"request-pto",
"hero",
"balances"
]
}
]
}
],
"id": "request-pto",
"isVisible": false
}
],
"$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
"version": "1.4"
}