Skip to main content

Notifications

Community site session details

Community site session details

Session Id :

Not able to do the paging cookie to get more then 5000 records in loop using liquid in power apps portals

 Profile Picture Posted by Community member

Hi, 

I am able to do the pagination using paging cookie for the buttons (next and previous buttons), but I wanted to do the pagination in loop to get all the records dynamically without clicking buttons. 

below is my liquid to send the paging cookie. 

{% assign page = 1 %}

{% assign paging-cookie = '' %}

{% assign allRecords = "" | split: "," %}

{% for page in (1..10) %}

  {% fetchxml accounts %}

  <fetch page="{{ page }}" {{ paging-cookie }} count="5000">

    <entity name="product">

      <attribute name="name" />

    </entity>

  </fetch>

  {% endfetchxml %}

  {% assign paging-cookie = 'paging-cookie=' | append: accounts.results.paging_cookie | url_encode | url_encode %}

  {% assign currentPageRecords = accounts.results.entities | join: "," %}

  {% assign allRecords = allRecords | join: currentPageRecords | split: "," %}

  {% if accounts.results.more_records %}

    {% assign page = page | plus: 1 | integer %}

  {% else %}

    {% break %}

  {% endif %}

{% endfor %}

 

I am getting below error 

 

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

Categories:

General Tips & Tricks

Comments