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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Pages / Filter operation "like...
Power Pages
Suggested Answer

Filter operation "like" throws Liquid error when using value="%value%"

(1) ShareShare
ReportReport
Posted on by 4
Hi All,
 
I'm trying to create a custom component to display data from a virtual table. Following a tutorial I found, I created a filter in FetchXML to filter data that contains a substring in a string column. However, I'm seeing "Liquid error: Exception has been thrown by the target of an invocation." This is the FetchXML I'm trying to run:
 
{% fetchxml postsQuery %}
      <fetch version="1.0" mapping="logical" distinct="true">
        <entity name="cr6a3_projectlist">
          <attribute name="cr6a3_projectx0020name"></attribute>
		  ...
          <attribute name="cr6a3_modified"></attribute>
          <order attribute="cr6a3_projectx0020name" descending="false" />
          <filter type="and">
            <condition attribute="cr6a3_isactive" operator="eq" value="1" />
            <condition attribute="cr6a3_location" operator="like" value="%value%" ></condition>
          </filter>
        </entity>
      </fetch>
{% endfetchxml %}
 
I have tested this FetchXML without the 'location' condition, so I can confirm that the attributes and 'isactive' condition are working fine. Interestingly, when I changed value="%value%" to value="value%", it returned some results, though I need both wildcards due to the nature of my data. Not sure if this is relevant, I've read here that it is not recommended to use "%value", and I received the same error when I tested it out myself.
 
I'm new to Liquid and Power Pages, so I'd appreciate any help or workaround for this. Thanks in advance.
Categories:
I have the same question (0)
  • Suggested answer
    Suriyanarayanan V Profile Picture
    196 on at

    Why your FetchXML fails with LIKE '%value%'

    This error:

    Liquid error: Exception has been thrown by the target of an invocation

    is very common when using virtual tables + FetchXML + LIKE with leading wildcards.

    The root cause:

    Virtual tables do not support server‑side substring searches (LIKE '%value%') because the underlying provider (SharePoint in your case) cannot translate that query into its native API.

    So when Power Pages sends:

    <condition attribute="cr6a3_location" operator="like" value="%value%" />
    

    Dataverse tries to push that filter down to the SharePoint virtual table provider, and the provider throws an exception — which surfaces as the Liquid error you’re seeing.

    This is by design and affects all virtual tables, not just SharePoint.

    Why value% works but %value% does not

    SharePoint (and most virtual table providers) can translate:

    • LIKE 'value%'starts with
      …but cannot translate:

    • LIKE '%value%'contains

    This is why you get results with value% but an exception with %value%.

    Why you cannot fix this with Liquid alone

    Liquid runs after FetchXML executes.

    If FetchXML fails, Liquid never gets a chance to run.

    So you cannot do:

    • LIKE '%value%' in FetchXML

    • Then filter in Liquid

    Because the FetchXML query itself fails before Liquid executes.

    The correct workaround (supported)

    1. Remove the substring filter from FetchXML

    Fetch all rows you need:

    <filter>
      <condition attribute="cr6a3_isactive" operator="eq" value="1" />
    </filter>
    

    2. Apply substring filtering in Liquid

    Liquid can do substring checks:

    {% assign search = value | downcase %}
    
    {% for row in postsQuery.results.entities %}
        {% assign location = row.cr6a3_location | downcase %}
        {% if location contains search %}
            <!-- Render your row -->
        {% endif %}
    {% endfor %}
    

    This works because Liquid filtering happens in memory, not via the virtual table provider.

    Performance note

    If your virtual table contains thousands of rows, client‑side filtering may be slow.
    If that happens, consider:

    • Adding a “starts with” filter in FetchXML to reduce the dataset

    • Or storing a search‑friendly normalized column in SharePoint (e.g., lowercase, concatenated keywords)

    Summary

    • %value% fails because virtual tables do not support contains searches.

    • value% works because starts‑with is supported.

    • The only reliable workaround is:
      Fetch without substring filtering → filter using Liquid.

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Leaderboard > Power Pages

#1
Lucas001 Profile Picture

Lucas001 17 Super User 2026 Season 1

#2
Haque Profile Picture

Haque 12

#2
CN-06091549-0 Profile Picture

CN-06091549-0 12

Last 30 days Overall leaderboard