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

How to Reference Datacard in sort

(0) ShareShare
ReportReport
Posted on by

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
    153,040 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
    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
    153,040 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
    on at

    The field is StartDateTime

  • Community Power Platform Member Profile Picture
    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
    153,040 Most Valuable Professional on at

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

  • Community Power Platform Member Profile Picture
    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
    153,040 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

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 Apps

#1
WarrenBelz Profile Picture

WarrenBelz 717 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 329 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard