cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
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
Super User
Super User

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
Super User
Super User

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

Super User
Super User

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.

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
secondImage

Experience what’s next for Power Apps

Join us for an in-depth look at the new Power Apps features and capabilities at the free Microsoft Business Applications Launch Event.

Power Apps Community Call

Power Apps Community Call: February

Did you miss the call? Check out the Power Apps Community Call here.

New Power Super Users

Congratulations!

We are excited to announce the Power Apps Super Users!

New Badges

New Solution Badges!

Check out our new profile badges recognizing authored solutions!

Top Solution Authors
Top Kudoed Authors
Users online (9,692)