cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
leanns
Helper II
Helper II

Equals Expression Not Right

Hello,

 

I have a flow that checks if a file has been through the approval process or not (a different flow) by looking at its name and by comparing it to a value in a sharepoint list that's generated from the other flow mentioned and if it has  been move it to its appropriate folder based on response from an email. I have two questions with this flow at the moment, one I've been actively trying to fix and the other I haven't spent as much time on.

 

1. Equals Expression

I have a condition (shown below) that I would like to check the name of the file thats being checked (the when a file is created (properties only) trigger) contains the '.Approved', which is what I have in the condition at the moment so that way it works when I test the flow since the other part isn't working. Along with this, I want the condition to check that the Approved column in the Sharepoint List for that item has the value yes (true when it's imported into the flow). This is where I'm struggling.

 

equals(body('Get_items')?['Approved'],'true')

This is the equation I'm using at the moment but every time I run it, it returns false. It should return true but its not and I'm not sure what I'm doing wrong. I'm writing the word true exactly how it gets outputted from the Get Items action as shown below. Any thoughts?

 

 

In the end, I'd like to do an and expression to combine them together but until I get this part, I can't.

 

2. When I'm moving the file into its new folder, a subfolder of the one its in, it loses it's content even though the file content is being used. I've also noticed that it loses its type (ex. excel). Is there a way around this? I know subfolders isn't fully supported on Flow yet but is possible.

Overall FlowOverall FlowGet Items Body OutputGet Items Body OutputConditionConditionFile in Main FolderFile in Main Folder 

File in SubfolderFile in Subfolder

 

 

 

 

 

 

 

 

 

 

 

 

Thanks,

leanns

1 ACCEPTED SOLUTION

Accepted Solutions
v-xida-msft
Community Support
Community Support

Hi @leanns,

 

Could you please share a bit more about the Approved column within your SharePoint List? Is it a Yes/No type column?

 

I suppose that the Approved column within your SP list is a Yes/No type column, is it true?

 

If the Approved column is a Yes/No type column in within your SP list, I think there is something wrong with the Equals Expression that you provided. Please take a try to modify your Equals Expression as below to check if the issue is solved:

equals(body('Get_items')?['Approved'],true)

Note: The true is a Boolean value rather than a string. The true is not wrapped with single quotes.

 

For your second question, could you please share a bit more about the replace() expression within the File Name field of the "Create file" action?

 

I think there is something wrong with the formula that you provided within the File Name field of the "Create file" action. Please check if the result the replace() expression returned contains the file name extension, if not, please append the file name extension into the replace() expression.  Please check and see if the following thread would help in your scenario:

https://powerusers.microsoft.com/t5/Building-Flows/Renaming-files-using-a-Flow/m-p/120101/highlight/...

 

 

More detais about creating a file within a new created subfolder folder, please check the following thread:

https://powerusers.microsoft.com/t5/Building-Flows/create-new-folder/m-p/117084/highlight/true#M1134...

 

 

Best regards,

Kris

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

4 REPLIES 4
v-xida-msft
Community Support
Community Support

Hi @leanns,

 

Could you please share a bit more about the Approved column within your SharePoint List? Is it a Yes/No type column?

 

I suppose that the Approved column within your SP list is a Yes/No type column, is it true?

 

If the Approved column is a Yes/No type column in within your SP list, I think there is something wrong with the Equals Expression that you provided. Please take a try to modify your Equals Expression as below to check if the issue is solved:

equals(body('Get_items')?['Approved'],true)

Note: The true is a Boolean value rather than a string. The true is not wrapped with single quotes.

 

For your second question, could you please share a bit more about the replace() expression within the File Name field of the "Create file" action?

 

I think there is something wrong with the formula that you provided within the File Name field of the "Create file" action. Please check if the result the replace() expression returned contains the file name extension, if not, please append the file name extension into the replace() expression.  Please check and see if the following thread would help in your scenario:

https://powerusers.microsoft.com/t5/Building-Flows/Renaming-files-using-a-Flow/m-p/120101/highlight/...

 

 

More detais about creating a file within a new created subfolder folder, please check the following thread:

https://powerusers.microsoft.com/t5/Building-Flows/create-new-folder/m-p/117084/highlight/true#M1134...

 

 

Best regards,

Kris

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

@v-xida-msft

 

Thank you for the suggestions. They fixed my problems mentioned above. I appreciate the help. I did have to do a work around since I couldn't pull the Approved token from the Get Items actions by using some compose statements and a variable. But the equation works, I just had to grab the token in a different way.

 

I have marked your reply as my solution.

 

Thank you again,

leanns

@v-xida-msft,

 

Hello, as I am trying to combine my equals expression and Name check expression together I keep getting an error. I was wondering if you could take a look and see what little thing I'm missing because they work separately but not together.

 

contains(triggerBody()?['Name'],'__Approved')

*the __ is a double underscore

 

equals(outputs('Compose_2'),true)

 I've tried combining them with the and expression and the if expression but I keep getting this error:

contains_error.PNG

 

 

 

 

Here's a picture of the flow that I'm trying to fix:

                         expressions.PNG

 

 

 

 

 

 

 

 

 

 

Thanks again,

leanns

Nevermind I figured it out. I just needed to retype in the expressions. The syntax wasn't correct for the triggerBody() expression.

Helpful resources

Announcements
MPA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

MBAS on Demand

Microsoft Business Applications Summit sessions

On-demand access to all the great content presented by the product teams and community members! #MSBizAppsSummit #CommunityRocks

MBAS Attendee Badge

Claim Your Badge & Digital Swag!

Check out how to claim yours today!

secondImage

Are Your Ready?

Test your skills now with the Cloud Skill Challenge.

Top Solution Authors
Users online (71,008)