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 Apps / How to Reference Datac...
Power Apps
Answered

How to Reference Datacard in sort

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

I'm trying to filter and sort.  But not having luck with the syntax for the datacard.  What's wrong with it ?

 

SortByColumns(Filter('1920PersonnelTimesheets',Or(Administrator=User().FullName, Secretary=User().FullName),IsBlank(ApprovalStatus)),"Title",Ascending,StartDateTime_DataCard2,Ascending)

Categories:
I have the same question (0)
  • WarrenBelz Profile Picture
    156,319 Most Valuable Professional on at

    Hi @Anonymous ,
    The line 

    StartDateTime_DataCard2, Ascending

    is the issue - you need to sort the field in the data source, not what is in this card - I assume this is StartDateTime
    Second issue User().FullName is not a delegable query. Easy to fix - at App OnStart, set a Variable

    Set(vUserName,User().FullName)

    - so now your code

    SortByColumns(
     Filter(
     '1920PersonnelTimesheets',
     (Administrator=vUserName || Secretary=vUserName) && IsBlank(ApprovalStatus)
     ),
     "Title",
     Ascending,
     "StartDateTime",
     Ascending
    )

     

     

    Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Thank you for the advice, but the filter is working fine.  

     

    When I try to enter the Column Name "StartDateTime" it does not recognize the column and recommends using the datacard instead.  Do you reference a datetime field from Sharepoint differently in the sort ?

  • WarrenBelz Profile Picture
    156,319 Most Valuable Professional on at

    OK @Anonymous ,

    I was making the assumption that this is the field name in your data that is in the card.

    What is the field name in your table '1920PersonnelTimesheets' that is in  StartDateTime_DataCard2 as this is what you need to Sort on?

     

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    The field is StartDateTime

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    When I write the column name as below, I get the error that this column does not exist

     

    SortByColumns(Filter('1920PersonnelTimesheets',Or(Administrator=User().FullName, Secretary=User().FullName),IsBlank(ApprovalStatus)),"Title",Ascending,"StartDateTime", Ascending)

  • Verified answer
    WarrenBelz Profile Picture
    156,319 Most Valuable Professional on at

    I assume it is a date/time field in SharePoint?

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Found the problem.  The column name had been changed after its original creation.

    Once I entered the original column name, it worked.

     

     

  • WarrenBelz Profile Picture
    156,319 Most Valuable Professional on at

    Good @Anonymous ,

    It had to be something like that as the syntax I provided should be valid.

     

     

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 392 Most Valuable Professional

#2
11manish Profile Picture

11manish 181 Super User 2026 Season 2

#3
MS.Ragavendar Profile Picture

MS.Ragavendar 112 Super User 2026 Season 2

Last 30 days Overall leaderboard