cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Anonymous
Not applicable

collection not removing value

I am trying to test something with a collection that relates to another question i asked yesterday. My problem is that I have a button with the following code. 

Collect(test; "a");;
ClearCollect(test; "a");;
Collect(test; "b");;
ClearCollect(test; "b");;
This is purely for testing but my problem is that when i click on this button, The "b"  remains in the collection. This has been stressing me out for the past few days. Thanks in advance

1 ACCEPTED SOLUTION

Accepted Solutions

So ...ClearCollect function is used to clear a collection and add the items after the "," in your case "a".

 

Use only CLEAR function if you want a empty collection.

View solution in original post

4 REPLIES 4
gabibalaban
Super User II
Super User II

First command: add "a" value to test collection.

Second command: clear all data from test collection and add "a" as a record,

Third command: add "a" value to test collection (so the collection is after this command {"a","b"};

The last command: ClearCollect(test; "b");; erase all data from test collection and add "b" as a record.

 

So you code fill the test collection with "b" value.

 

If you want to clear the test collection you should use: Clear(test). 

 

Hope it helps!

Anonymous
Not applicable

I understand but what im trying to do is i have a checkbox with the following.
OnCheck = Collect(test; "a");;

UnCheck= ClearCollect(test; "a");;

For some reason the "a" would still be there.

 

So ...ClearCollect function is used to clear a collection and add the items after the "," in your case "a".

 

Use only CLEAR function if you want a empty collection.

View solution in original post

Anonymous
Not applicable

oh oke thank you. i just need to use some if statements

Helpful resources

Announcements
PA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

secondImage

Demo Extravaganza is Back!

We are excited to announce that Demo Extravaganza for 2021 has started!

MBAS on Demand

Microsoft Business Applications Summit sessions

On-demand access to all the great content presented by the product teams and community members! #MSBizAppsSummit #CommunityRocks

Power Apps June 2021

June Power Apps Community Call

Did you miss the call? Check out the recording here!

Top Solution Authors
Top Kudoed Authors
Users online (20,709)