cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
CollabTechie
Responsive Resident
Responsive Resident

SharePoint filter query and compose output

Hi Community,
I need to apply a filter query based on dynamic content but I am noticing some odd behavior with the compose output. I'n hoping someone can help.

This is my filter query which was working fine for mail but problems arise when I added an additional filter.

 

FilterQuery.JPG

The filter query works fine when I manually type the string BUT the output from compose looks identical. Although the output seems to push the last ' out when I look at the 'Get Items' action after a run.

Example of ' push out.

PPUS.JPG

Any ideas?

10 REPLIES 10
efialttes
Super User III
Super User III

Hi!

It looks you have a 'new line' character in your Compose output, right?

If you want to remove it my suggestion is to replace its output from the ODATA expression and the following expression instead

replace(outputs('Compose'),'
','')

When writing the expression, just hit enter

 

Plase note I am assuming that the name of your Compose action block is 'Compose'

Hope this helps



Each time you click on any of our inspiring answers 'Thumb up' icon...
...an ewok scapes from the stormtroopers.

Be grateful, Thumbs up! Save the Galaxy for free!


Escribo sobre Power Automate en:
https://medium.com/anyone-can-automate/

Proud to be a Flownaut!



Thanks for your reply.

It does look like it's putting a new line character in and that's why I've tried to use compose. I'm actually passing a Forms response in via compose but I don't see anything that would obviously cause a new line. It's a choice field from Forms.

I tried to use your expression in the ODATA query but the flow failed and then I tried to add an additional compose to use the expression and the result was the same. 

I've re-checked my Forms choices and there isn't any spaces in the choice at all. When I pass it through compose, the output is PPUS. Really confusing..

Hi again!

Some connectors have ODATA format restrictions.. which Connector and Action block are you using? Sharepoint 'Get items'? Excel 'List rows present in a table'? Other?

Did you also consider moving your filter logic into a 'Filter array' action block? A bot worse performance, but much much easier to define and with less restrictions

Hope this helps



Each time you click on any of our inspiring answers 'Thumb up' icon...
...an ewok scapes from the stormtroopers.

Be grateful, Thumbs up! Save the Galaxy for free!


Escribo sobre Power Automate en:
https://medium.com/anyone-can-automate/

Proud to be a Flownaut!



Hi @efialttes ,

I am using the SharePoint 'Get Items' action in this case. I've passed compose outputs via this connector for  things like today's date and other values before. It seemed to work well.

I've not tried the Filter Array option as I've not got much experience with that and not sure how to approach it to be honest.

Here is my whole Flow

FullFlow.JPG

Any other ideas?

Hi again!

So I believe the problem is ... 'Get items' output is empty, right?

JUst guessing... Is 'Org' sharepoint field of type 'Single line of Text'? Or... Choice? Or Lookup?

So, if your field is a Lookup, you need to declare it in a different way:

Lookup Columns are supported in Filter Query – you can search by ID of the item in the lookup column. There is a special syntax that works:
[Lookup Column Internal Name]/Id eq ‘[ID Column]’.

Examples:
MainTraining/Id eq ‘@{triggerBody()?[‘Id’]}’
MainTraining/Id eq ‘@{body(‘Get_Main_Training_Event’)?[‘ID’]}’
Training/Id eq ‘@{triggerBody()?[‘Training’]?[‘Id’]}’

...as explained in one of the comments posted in this blog entry:
https://www.chakkaradeep.com/2018/05/01/deep-dive-into-get-items-and-get-files-sharepoint-actions-in-microsoft-flow/

 

If this is not the problem... can you also share a screenshot from your Compose action block result (by going to Run History, select any of the flow executions)?

Thanx!

 



Each time you click on any of our inspiring answers 'Thumb up' icon...
...an ewok scapes from the stormtroopers.

Be grateful, Thumbs up! Save the Galaxy for free!


Escribo sobre Power Automate en:
https://medium.com/anyone-can-automate/

Proud to be a Flownaut!



Hey @efialttes 
Thanks again for your response.
The Org field is a choice column. And correct, the Get Items runs successfully but doesn't return anything.

Here is the Output of the compose action and this is what I am passing into the ODATA query

Compose.JPG

I tried to create a new flow to test it out with pulling back Org only. In this failure, it looks like the compose action is actually passing through a linebreak!

LineBreak.JPG

Issue resolved. I passed the output from compose in via the 'convert html to text' action and then used the output of that in my ODATA query. Bizarre! 
Thanks again.

Hi again

And you already tried to add a second Compose to remove the new line, by adding the following expression, right?

replace(outputs('Compose'),'
','')

Then assign this second compose to build your ODATA expression

Please note the way to add expressions is by means of the dynamic content menu, as explained here

https://flow.microsoft.com/es-es/blog/use-expressions-in-actions/

 

Please try again this approach and share a scerenshot with the ODATA filter result during execution (as the one you shared in your last post)

Thanx!



Each time you click on any of our inspiring answers 'Thumb up' icon...
...an ewok scapes from the stormtroopers.

Be grateful, Thumbs up! Save the Galaxy for free!


Escribo sobre Power Automate en:
https://medium.com/anyone-can-automate/

Proud to be a Flownaut!



Helpful resources

Announcements
MBAS Attendee Badge

Claim Your Badge & Digital Swag!

Check out how to claim yours today!

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

secondImage

Are Your Ready?

Test your skills now with the Cloud Skill Challenge.

Top Solution Authors
Users online (47,819)