Use Equals Expression For Simple Data Transformations
In this tip, we will discuss the equals expression which we can be used to perform simple data transformations by evaluating one value against another. More specifically, the Microsoft documentation describes the equals behavior as: “Checks whether both values, expressions, or objects are equivalent. Return true when both are equivalent or return false when they're not equivalent.”
On the SharePoint side, we have a list defined, that includes Yes/No columns for this data. Calling them Yes/No fields is a bit misleading as you can’t send the list a Yes or No value and certainly not as a String. Instead we need to send a Boolean value.
This is where our equals expression comes in as it is able to detect if our form value is equal to ‘Yes’ and if it is, it will return a true value that is sent to SharePoint. In the event, it is not equal to ‘Yes’, then a false value will be sent to SharePoint.
We can include equals expressions for each of our Yes/No questions and include them in SharePoint Create Item action. As a result, our expression looks like the following:
With our configuration set, we can now perform a test. To illustrate both a ‘Yes’ and ‘No’ scenario, we will specify on the form that we are interested in Microsoft Flow and Azure Logic Apps information, but not PowerApps.
When we run our logic app, we will see that our ‘Yes’ values coming from Microsoft Forms are converted to true values before they are inserted into SharePoint. On the flipside, our ‘No’ value from Microsoft Forms is converted to a false value as it is inserted into SharePoint.
Using the equals expression allows us to detect a specific value and then return a Boolean value that indicates if we have a match. It becomes very useful when translating Strings to Boolean values.