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 / The data source suppli...
Power Apps
Answered

The data source supplied to the function is invalid.

(0) ShareShare
ReportReport
Posted on by 1,401 Moderator

My Scene has OnVisible

 

Set(VarSection,"");
ClearCollect(
 ColSessions,
 {
 Session: "",
 Section: "",
 Site: ""
 }
);

 

 

My Button has OnSelect

 

If(
 CountRows(Filter(ColSessions,Section = VarSection)) < 1,
 Set(VarSession,GUID())
);

Patch(
 ColSessions,
 {
 Session: VarSession,
 Section: VarSection,
 Site: VarSite
 }
 )
);

 

 

This works after the first press, but the second press has an error on the Patch saying " The data source supplied to the function is invalid."

Categories:
  • v-yueyun-msft Profile Picture
    Microsoft Employee on at

    Hi , @IPC_ahaas 

    Do you mean you want to add the record in your "ColSessions" collection?

    If this , you can try to use this code:

    If(
     CountRows(Filter(ColSessions,Section = VarSection)) < 1,
     Set(VarSession,GUID())
    );
    
    Patch(
     ColSessions, Defaults(ColSessions ),
     {
     Session: VarSession,
     Section: VarSection,
     Site: VarSite
     }
     
    );

    Patch(datacource/colllection , Derfaults(datacource/colllection),record)

     

    And for more information, you can refer to :
    Patch function (contains video) - Power Platform | Microsoft Learn

     

     

    Best Regards,

    Yueyun Zhang

     

  • IPC_ahaas Profile Picture
    1,401 Moderator on at

    With that, I get:

     

    "Unexpected charterers. Characters are used in the formula in an unexpected way."

     

    on the last closing parenthesis.

     

    IPC_ahaas_0-1709065843382.png

     

  • Verified answer
    v-yueyun-msft Profile Picture
    Microsoft Employee on at

    Hi, @IPC_ahaas 

    It seems your code has one more ')' in the end of the code.

    vyueyunmsft_0-1709086102500.png

     

     

    Best Regards,

    Yueyun Zhang

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

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 342 Super User 2026 Season 2

#2
M Bilal Khan Profile Picture

M Bilal Khan 258

#3
Mohsin Ali Profile Picture

Mohsin Ali 231

Last 30 days Overall leaderboard