rpr
rpr

Reputation: 23

Azure Logic App slice string from SQL database to email

I have a super simple logic app workflow that triggers when a new row is added to a SQL Server Database and sends an email from a pre-specified address to another pre-specified address with variables from the row that was added.

I am having difficulty figuring out how to slice a string from the SQL data... One of the variables is called "invoiceDate" and I am able to refer to it in the logic app code view as "@{triggerBody()?['invoiceDate']} but an unable to perform slicing functions to it. I only want the first 9 characters of that variable to populate in the email and the slice function does not treat it like a variable.

Logic App Designer Workflow

Upvotes: 0

Views: 251

Answers (1)

Skin
Skin

Reputation: 11262

You need to use the substring expression.

https://learn.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#substring

This is a basic example ...

Example

The expression in the second step is ...

substring(variables('String'), 0, 9)

It's getting the first 9 characters of the String variable.

Result

Result

Upvotes: 0

Related Questions