web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Apostrophe in filter q...
Power Automate
Unanswered

Apostrophe in filter query causing flow to fail

(0) ShareShare
ReportReport
Posted on by 20

I have written the filter query in several ways and still my flow fails due to apostrophe in single line text field. My Get items action is within an apply to each action. 

PrimaryLocation/Street1 is a lookup to a single line field called Street1.

 

I am writing my query as follows however my flow fails : 

replace(items('Apply_to_each')?['body/Street1/Value'],'''','''''')
 
I have also tried this with no luck.
replace(items('Apply_to_each')?['body/Street1'],'''','''''')

 

rencygonzalez_0-1695394847887.png

 

 

I am really hoping someone can help.

 

thank you!

 

Categories:
I have the same question (0)
  • efialttes Profile Picture
    14,756 on at

    Hi @rencygonzalez !
    So I guess you have probably followed the recommendation in this post with no luck, right?
    https://powerusers.microsoft.com/t5/Building-Flows/Using-a-value-with-a-single-quote-as-an-Odata-filter-query/td-p/37043
    If so, did you consider to forget about ODATA filter and add a 'Filter Array' action block after 'Get items 2' instead?

    ¡Ánimo!
    ==========

  • rencygonzalez Profile Picture
    20 on at

    Hi! Thank you for your response! Yes I did try that post you had mentioned and it didnt work for me. Can you tell me what to put in the filter array? 

    Do you mean remove everything from the ODATA filter?

     

    rencygonzalez_0-1695397247284.png

     

  • Chriddle Profile Picture
    8,436 Super User 2025 Season 2 on at

    What about this? Probably your value does not have a body.

    replace(items('Apply_to_each')['Street1'],'''','''''')

    If you leave out the question mark, you will see in the possible error message whether the property exists.

  • efialttes Profile Picture
    14,756 on at

    Hi again @rencygonzalez !
    You shall select 'Get items 2' 'value' output and assign it as 'Filter array' 'From' input. In order to show the 'dynamic content menu' just click inide the input, and then on 'add dynamic content' label

    efialttes_0-1695398290059.png

     


    Next you need to build the 'Filter array' 'Condition rule'
    You can keep default operator 'is equal to'
    As right term you can add the following WDL expression : items('Apply_to_each')?['Street1/Value']. Please note you can select it also from the dynamic content menu, as we did before with 'Value'
    For the left term I need more context info. I mean, it seems you are trying to compare two different SP columns per item, right? One is called 'Street1' and is of type lookup column, right? And the other perhaps is called PrimaryLocation, right?. How is this second column declared in your SP list? Is it also a Lookup? Is it a 'Single line of text? Please note you can select it also from the dynamic content menu, as we did before with 'Value'

    Thanx!
    ====

  • rencygonzalez Profile Picture
    20 on at

    Yes I am comparing two different columns. PrimaryLocation is in my list called Contacts. It is a lookup column to another column called Street1 in a different list. So I am trying to see if PrimaryLocation/Street1(lookup) is equal to Street1.  Issue is , end users put apostrophe in the Street1 field and I need to remove those. 

    So like this?

     

    rencygonzalez_0-1695399132567.png

     

     

  • rencygonzalez Profile Picture
    20 on at

    thank you, I tried this and it still failed.

  • efialttes Profile Picture
    14,756 on at

    Hi @rencygonzalez 
    Your attempt with 'Filter array' approach is almost ready!
    However, if you declare the text 'PrimaryLocation/Street1' as the value for the left term, I am afraid the result will not be the one you expect. If the column is called 'PrimaryLocation' of type Lookup, you can try to add as left term value either a dinamyc content input that should be called 'PrimaryLocation value' -the same way you did it with the dynamic content 'Value' or add the following WDL expression: items('Apply_to_each')?['PrimaryLocation/Value']

    Hope this helps!
    ==========

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 522 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 364 Moderator

#3
abm abm Profile Picture

abm abm 243 Most Valuable Professional

Last 30 days Overall leaderboard