cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
val43
Level: Powered On

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
mdevaney
Level 8

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
mdevaney
Level 8

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
Level: Powered On

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
Level: Powered On

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.

mdevaney
Level 8

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
Level: Powered On

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
Level: Powered On

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
Level: Powered On

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
thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Power Platform World Tour

Find out where you can attend!

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

Top Kudoed Authors
Users Online
Currently online: 322 members 5,841 guests
Please welcome our newest community members: