cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
val43 Helper II
Helper II

ClearCollect argument invalid

Hi, 

I can't figure out what's wrong with a very simple string of code. I'm getting the following error:

"the type of argument is not valid. One of the following is expected: Boolean, Number, Text"

 

This is my code, I'm just trying to populate a collection:

OnStart = ClearCollect(aCollection; {FirstCol: 1; SecondCol: "something"}; {FirstCol: 2; SecondCol: "anything"})

NOTE that I'm using the SEMICOLON in place of the comma, because I'm using the italian locale.

For your convenience, here's the same code using commas:

OnStart = ClearCollect(aCollection, {FirstCol: 1, SecondCol: "something"}, {FirstCol: 2, SecondCol: "anything"})

And here's the result:

clearcollectresults.png

 

 

 

 

clearcollect.png

 

 

 

2 ACCEPTED SOLUTIONS

Accepted Solutions
Super User
Super User

Re: ClearCollect argument invalid

@val43 

Is it possible this problem is being caused by your code preceding the ClearCollect statement?  Could you please share the entire code block?

 

I am sure by working together @timl and I can help you fix the problem!

View solution in original post

Super User
Super User

Re: ClearCollect argument invalid

Hi @val43 

Just to confirm, are you re-running your OnStart formula by using the 'Run OnStart' menu item?

 

image.png

View solution in original post

10 REPLIES 10
Super User
Super User

Re: ClearCollect argument invalid

@val43 

Have you tried using a comma ( , ) as your separator instead of a semi-colon ( ; )?  See example below

 

OnStart = ClearCollect(aCollection, {FirstCol: 1, SecondCol: "something"}, {FirstCol: 2, SecondCol: "anything"})

 

---
Please click "Accept as Solution" if my response helped to solve your issue so that others may find it more quickly. If your thought the post was helpful please give it a "Thumbs Up."

 

val43 Helper II
Helper II

Re: ClearCollect argument invalid

as I already said, in the Italian locale all commas are replaced by semicolons

Super User
Super User

Re: ClearCollect argument invalid

Hi @val43 

As an experiment, do you get the same error if you provide a table of records to ClearCollect?

ClearCollect(aCollection; 
Table({FirstCol: 1; SecondCol: "something"}; {FirstCol: 2; SecondCol: "anything"})
)

Also, are you Collecting/ClearCollecting records into aCollection in other parts of your app? If the structure of the data that you're collecting into aCollection differs in other parts of your app, this could also be a possible explanation.

val43 Helper II
Helper II

Re: ClearCollect argument invalid

Hi @timl 

Thank you for replying.

yes, I do get the same error.

no, I'm not using "aCollection" collection anywhere else. I get the same error whatever names I use for the collection or the fields.

Super User
Super User

Re: ClearCollect argument invalid

@val43 

Is it possible this problem is being caused by your code preceding the ClearCollect statement?  Could you please share the entire code block?

 

I am sure by working together @timl and I can help you fix the problem!

View solution in original post

val43 Helper II
Helper II

Re: ClearCollect argument invalid

@mdevaney 

YES!, the error disappears if I remove the preceding code

BUT the collection still appears to be empty:

clearcollectresults.png

 

this is the whole code:

If(IsBlank(LookUp('helpdesk-technicians';User().Email in 'helpdesk-technicians'.Email));Set(isAdmin;false);Set(isAdmin;true))
&&
ClearCollect(aCollection; Table({FirstCol: 1; SecondCol: "something"}; {FirstCol: 2; SecondCol: "anything"}))
val43 Helper II
Helper II

Re: ClearCollect argument invalid

Ok, I just realized that I should have used

;;

in place of

&&

because I couldn't find THIS PAGE and I had no idea how to properly chain more formulas, so I just tried everything till && worked

 

STILL, the collection appears to be empty

Super User
Super User

Re: ClearCollect argument invalid

Hi @val43 

Just to confirm, are you re-running your OnStart formula by using the 'Run OnStart' menu item?

 

image.png

View solution in original post

val43 Helper II
Helper II

Re: ClearCollect argument invalid

Ah! I didn't know that that was necessary. 

thank you @timl 

if you don't mind, since the subject of this post was the original error, I'll mark @mdevaney reply as the solution

Helpful resources

Announcements
firstImage

New Ranks and Rank Icons released on April 21!

The time has come: We are finally able to share more details on the brand-new ranks coming to the Power Apps Community!

Top Solution Authors
Top Kudoed Authors
Users online (8,051)