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 / Set variable to collec...
Power Apps
Unanswered

Set variable to collection - Unexpected character. The formula contains 'Ident' where 'Data' is expected

(0) ShareShare
ReportReport
Posted on by 2

Hi,

I encountered a problem when defining variables. First, I assigns collection from the sql database to a variable (onVisible property of screen):

 

Set(varMyCollection, Filter(Table1, ID = varSelectedUser));

 

Then I set the DefaultSelectedItems parameter of the combobox to varMyCollection.

Rogal123_0-1660041147808.png

Up to this point everything is working fine.

 

In the next step, I add a button that is responsible for adding new values to Table1. After each addition, I want to refresh the currently selected items with this code

 

Patch...
Refresh(Table1);
Collect(varMyCollection, Last(Table1));
Reset(Combobox);
Collect(varMyCollection, Filter(Table1, ID = varSelectedUser));

 

The problem is that when adding the above code to the button, there is an error in the onVisible property of screen next to my Set(varMyCollection.... that says: Unexpected character. The formula contains 'Ident' where 'Data' is expected

 

Categories:
I have the same question (0)
  • Nogueira1306 Profile Picture
    7,390 Super User 2024 Season 1 on at

    I think that you should have this:

     

    ClearCollect(colMyCollection, Filter(Table1, ID = varSelectedUser));

     

    After that, set the DefaultSelectItems as colMyCollection

     

    After that:

     

    Patch...
    Refresh(Table1);
    Collect(colMyCollection, Last(Table1));
    Reset(Combobox);
    Collect(colMyCollection, Filter(Table1, ID = varSelectedUser));

     

    Bu tthis will duplicate some data... Tell me what you really want to do

  • Rogal123 Profile Picture
    2 on at

    When trying to use ClearCollect, the combobox is empty at view/edit instead of displaying values.

  • Nogueira1306 Profile Picture
    7,390 Super User 2024 Season 1 on at

    https://docs.microsoft.com/en-us/power-platform/power-fx/reference/function-clear-collect-clearcollect

     

     

    You can use only Collect but ClearCollect should clear the data and after that re-add

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 358 Most Valuable Professional

#2
11manish Profile Picture

11manish 207 Super User 2026 Season 2

#3
MS.Ragavendar Profile Picture

MS.Ragavendar 150 Super User 2026 Season 2

Last 30 days Overall leaderboard