cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
leanns
Level: Powered On

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.

approval_check.PNGOverall Flowapproval_check2.PNGGet Items Body Outputapproval_check_condition.PNGConditionapproval_check3.PNGFile in Main Folder 

approval_check4.PNGFile in Subfolder

 

 

 

 

 

 

 

 

 

 

 

 

Thanks,

leanns

1 ACCEPTED SOLUTION

Accepted Solutions
Community Support Team
Community Support Team

Re: Equals Expression Not Right

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
Community Support Team
Community Support Team

Re: Equals Expression Not Right

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

leanns
Level: Powered On

Re: Equals Expression Not Right

@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

leanns
Level: Powered On

Re: Equals Expression Not Right

@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

leanns
Level: Powered On

Re: Equals Expression Not Right

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
thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

firstImage

Incoming: New and improved badges!

We've given our badges an overhaul and also added some brand new ones!

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

sixthImage

Power Platform World Tour

Find out where you can attend!

seventhimage

Webinars & Video Gallery

Watch & learn from the Power Automate Community Video Gallery!

Top Kudoed Authors
Users Online
Currently online: 193 members 4,977 guests
Please welcome our newest community members: