cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
New Member

Unexpected characters and Invalid number of arguments on combobox that works fine

I have a combobox with the following code for items:

Combobox_CTC_4.Items=

Filter(
    Sort(_ChargeTypes, ChargeTypeCode),
    ChargeGroupCode = First(ComboBox_CGC.SelectedItems).Result
)

_ChargeTypes is a collection that looks something like this:

Spoiler
Capture13.PNG


The items in Combobox_CTC_4 are filtered so their ChargeGroupCode matches the ChargeGroupCode picked in another combobox (Combobox_CGC).

 

I get 2 errors on Combobox_CTC_4:

  • Unexpected characters. The formula contains 'ParenClose' where 'Eof' is expected.
    Location: Combobox_CTC_4.SearchItems
  • Invalid number of arguments: received 1, expected 3 or more. 
    Location: Combobox_CTC_4.SearchItems

The weird thing is, the combobox functions properly. I still get the little red error icon next to the combobox, but I go into the code and there are no red underlines anywhere.

I've tried saving and restarting the studio but it still remains...

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Super User
Super User

Re: Unexpected characters and Invalid number of arguments on combobox that works fine

There are few things I am not placing but one thing I know right off is your order is off. Sort goes before Filter and also I don't see where you are telling it what to sort by and Ascending or Descending either.

 

It goes like this:

 

Sort(Filter(DataSoure, Column1="FilterInfo"),"ColumnSortedBy",Ascending)

View solution in original post

3 REPLIES 3
Highlighted
Super User
Super User

Re: Unexpected characters and Invalid number of arguments on combobox that works fine

There are few things I am not placing but one thing I know right off is your order is off. Sort goes before Filter and also I don't see where you are telling it what to sort by and Ascending or Descending either.

 

It goes like this:

 

Sort(Filter(DataSoure, Column1="FilterInfo"),"ColumnSortedBy",Ascending)

View solution in original post

Highlighted
Super User
Super User

Re: Unexpected characters and Invalid number of arguments on combobox that works fine

What is the formula for the Items property of ComboBox_CGC?



--------------------------------------------------------------------------------
If this post helps answer your question, please click on “Accept as Solution” to help other members find it more quickly. If you thought this post was helpful, please give it a Thumbs Up.
Highlighted
New Member

Re: Unexpected characters and Invalid number of arguments on combobox that works fine

Thank you @rebeccas, switching the order of Sort and Filter fixed it. 

P.S.
I was sorting the collection _ChargeTypes by the column ChargeTypeCode. Also, I left out Ascending/Descending because it defaults to Ascending.

New Code:

Sort(
    Filter(_ChargeTypes, ChargeGroupCode = First(ComboBox_CGC.SelectedItems).Result),
    ChargeTypeCode
)

 

Helpful resources

Announcements
Check this Out

Helpful information

Featuring samples like Return to the Workplace and Emergency Response Applications

August 2020 Community Challenge: Can You Solve These?

August 2020 Community Challenge: Can You Solve These?

We're excited to announce our first cross-community 'Can You Solve These?' challenge!

secondImage

Return to Workplace

Reopen responsibly, monitor intelligently, and protect continuously with solutions for a safer work environment.

secondImage

Super Users Coming in August

We are excited for the next Super User season.

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Solution Authors
Top Kudoed Authors
Users online (7,134)