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 / Total count to be disp...
Power Pages
Answered

Total count to be displayed on top of the List view in the power apps portal site

(0) ShareShare
ReportReport
Posted on by 56

I wanted to display total number of records count on the top of the site in the List view of the portal site, as shown in the screen shot(1-34 of 35) like this.

Categories:
I have the same question (0)
  • Verified answer
    Inogic Profile Picture
    1,191 Moderator on at

    Hi @Hareesh2728 ,

     

    You can use the Liquid Template to get the total number of records of your respective entity.

     

    First, download the FetchXml from the CRM of the view that you want to display on the portal. We considered a scenario where we want to show the total count of the contacts listed in the view on the portal.

     

    Next, navigate to the Edit code for the selected web page where you want to show the count.

     

    Inogic_0-1694147611451.jpeg

     

    Paste and update the code given below to your HTML file for the selected web page.

     

    {% fetchxml contacts%}

    <fetch version="1.0" output-format="xml-platform" mapping="logical" distinct="false">

      <entity name="contact">

        <attribute name="fullname" />

        <attribute name="telephone1" />

        <attribute name="contactid" />

        <order attribute="fullname" descending="false" />

      </entity>

    </fetch>

    {% endfetchxml %} {% assign contactRecordCount = 0 %}

    {% for contact in contacts.results.entities %}

    {% assign contactRecordCount = contactRecordCount | plus: 1 %}

    {% endfor %}

     

    <div class="liquidContainer">

      <span id="contactRecordcount">Total contacts : {{contactRecordCount}}</span>

    </div>

     

    You have to fix the Counter element at the top of your list,

    Add the CSS code to the CSS file for the Selected Web Page,

     

    #contactRecordcount{

    position: relative;

    top: -112vh;

    left: 77vw;

    }

     

    Save and Sync the Website,

     

    Inogic_1-1694147611461.jpeg

    Thanks!

     

    Inogic Professional Services Division

    Power Platform and Microsoft Dynamics 365 CRM Development – All under one roof!

    Drop an email at crm@inogic.com

    Services:  http://www.inogic.com/services/

    Power Platform/Dynamics 365 CRM Tips and Tricks:  http://www.inogic.com/blog/

  • HD-30040748-0 Profile Picture
    56 on at

    Hi @Inogic ,

    How can I use this code to set up in the list view to show the records count based on the status values of the records, I mean open status records count to be shown separately and closed status records count to shown separately. As it is calculating total records in those two tabs but I need it as it should be calculated based on the records status.

    Thanks in advance

  • Inogic Profile Picture
    1,191 Moderator on at

    Hi @Hareesh2728 ,

     

    To obtain distinct counts for two separate logics, it is essential to establish two distinct web templates utilizing the provided code.

    Subsequently, you must modify the View's fetchXml to get both the open and closed records. Once done,

    You can seamlessly include the newly created web template into the desired webpage.

     

    For liquid syntax refer to the code given below,

    {%include ‘Your Web Template Name’%}

     

    Thanks!

     

    Inogic Professional Services Division

    Power Platform and Microsoft Dynamics 365 CRM Development – All under one roof!

    Drop an email at crm@inogic.com

    Services:  http://www.inogic.com/services/

    Power Platform/Dynamics 365 CRM Tips and Tricks:  http://www.inogic.com/blog/

  • HD-30040748-0 Profile Picture
    56 on at
    {% fetchxml contacts %}
          <fetch version="1.0" output-format="xml-platform" mapping="logical" distinct="false">
            <entity name="cre67_case">
              <attribute name="cre67_casenumber" />
              <attribute name="createdon" />
              <attribute name="cre67_caseid" />
              <order attribute="cre67_casenumber" descending="false" />
              <filter type="and">
                <condition attribute="cre67_status" operator="eq" value="Closed"/>
              </filter>
            </entity>
          </fetchxml>
        {% endfetchxml %}
       
        {% assign contactRecordCount = contacts.results.entities.size %}
       
     
          <div class="liquidContainer">
            <span id="contactRecordcount">Total Closed Cases: {{ contactRecordCount }}</span>
          </div>   
    The above one is my liquid code and it is showing the error instead of calculating the closed cases count, Can you please elaborate a little bit more with an updated liquid code.
    Thanks in advance
  • Verified answer
    Inogic Profile Picture
    1,191 Moderator on at

    Hi @Hareesh2728 ,

    As per our understanding, Your Status field is an option set type of field and when it is used within FetchXml instead of the status name or label the value of the Status should be used.

     

    Please refer to the code given below,

     

    {% fetchxml cases %}

      <fetch version="1.0" output-format="xml-platform" mapping="logical" distinct="false">

        <entity name="incident">

          <attribute name="title" />

          <attribute name="ticketnumber" />

          <attribute name="createdon" />

          <attribute name="incidentid" />

          <attribute name="caseorigincode" />

          <order attribute="title" descending="false" />

          <filter type="and">

            <condition attribute="statecode" operator="eq" value="1" />

          </filter>

        </entity>

      </fetch>

      {% endfetchxml %}

      {% assign contactRecordCount = cases.results.entities.size %}

      <p>Total closed Cases are {{ contactRecordCount }}.</p>

     

     

    In the Above fetchxml the Condition node has value to be compared is 1.

    Thanks!

     

    Inogic Professional Services Division

    Power Platform and Microsoft Dynamics 365 CRM Development – All under one roof!

    Drop an email at crm@inogic.com

    Services:  http://www.inogic.com/services/

    Power Platform/Dynamics 365 CRM Tips and Tricks:  http://www.inogic.com/blog/

  • HD-30040748-0 Profile Picture
    56 on at

    Hi @Inogic ,

    Yes it is worked and I have applied every where with the same changes now it is counting exact records with the filtered records and I need to know the below one can you please explain

     {% fetchxml cases %}

            <fetch version="1.0" output-format="xml-platform" mapping="logical" distinct="false">
              <entity name="new_myassets">
                <attribute name="new_name" />
                <attribute name="createdon" />
                <attribute name="new_myassetsid" />
                <order attribute="new_name" descending="false" />
         
                <filter type="and">
                  <condition attribute="new_dateofpurchase" operator="on-or-after" value="{{ 'now' | date: '%Y-01-01' }}" />
                  <condition attribute="new_dateofpurchase" operator="on-or-before" value="{{ 'now' | date: '%Y-12-31' }}" />
                </filter>
              </entity>
            </fetch>
         
          {% endfetchxml %}
         
          {% assign contactRecordCount = cases.results.entities.size %}
         
          <p>Total Recently Purchased Assets : {{ contactRecordCount }}.</p>
    I need to show the records based on this year in Recently Purchased Assets tab filter
     
  • Verified answer
    Inogic Profile Picture
    1,191 Moderator on at

    Hi @Hareesh2728 ,

     

    To get records that have been created this year you need to update the Fetch XML’s condition node,

     

    Please refer to the Fetch XML provided below,

     

    <fetch version="1.0" output-format="xml-platform" mapping="logical" distinct="false">

      <entity name="account">

        <attribute name="name" />

        <attribute name="primarycontactid" />

        <attribute name="telephone1" />

        <attribute name="accountid" />

        <order attribute="name" descending="false" />

        <filter type="and">

          <condition attribute="createdon" operator="this-year" />

        </filter>

      </entity>

    </fetch>

    Thanks!

     

    Inogic Professional Services Division

    Power Platform and Microsoft Dynamics 365 CRM Development – All under one roof!

    Drop an email at crm@inogic.com

    Services:  http://www.inogic.com/services/

    Power Platform/Dynamics 365 CRM Tips and Tricks:  http://www.inogic.com/blog/



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
Haque Profile Picture

Haque 10

#2
Suriyanarayanan V Profile Picture

Suriyanarayanan V 8

#3
oliver.rodrigues Profile Picture

oliver.rodrigues 5 Most Valuable Professional

Last 30 days Overall leaderboard