Error with Global Choice / Optionset with the same display name and In operator – Power Apps / Dataverse


Recently while trying to filter the Combo box Items using the value of the Global Multi-choice field, we were getting issues in the formula.

It was because the optionset / choice field in the table and the global optionset / choice, it was referring to, both were having the same display name.

Issue –

To get it working we renamed the display name of the Global Choice column.

After which we were able to get our formula working.

Same is the case for the single choice field which is referring to global choice.

Gender is the display name of the field in Lead and Global Gender is the display name of the global choice field.

LocalOptionset

Hope it helps..

 

Advertisements

Applying filter on Multi Choices / Multi-Select OptionSet – Power Apps / Dataverse


Say for e.g. we have 2 multi-select choice columns in our leads table, one is local (My Local Multi Choice Field) and the other field ((My Local Global Multi Choice Field) refers to the global option set field

In our Canvas App, to filter on ‘My Local Multi Choice Field’ by value Local Choice 2 and Local Choice 3, we can apply the below formula.

Similarly, for the Global option set to apply a filter on the Global Choice 2 value, we can compare the field in the lead with the values in the Global Option set.

As we are using “in” operator, we’d get the delegation warning. And for it to work in the case of combo box we would have to set “Allow Searching” to “Off

Hope it helps..

Advertisements

Fixed – Invalid data from the network error in the custom page – Power Apps / Dataverse


Recently in one of our custom pages, we were getting the below error

“Invalid data from the network”

We had this setting “Formula-level error management” as On, switching it off was hiding this error on the page.

To fix it we tried removing the fields one by one to figure out the issue. Eventually, we saw the error was going away if we remove one of the option set fields from the gallery or comment it’s formula. Later when we removed and added the field back in the gallery and the error got fixed for us.

The page loading properly without the error –

Hope it helps..

 

Advertisements

Using Sort, Distinct, Filter together for combo box Items– Canvas Apps (Dataverse)


Just sharing a simple example of applying a formula to the Combo box Items property, which includes Sort, Distinct, and Filter (If).

Below is our Combo Box bound to a lookup field of type Customer. If Contact is the option selected in the radio control, we want to show Contact’s Full Name sorted else Account’s Account Name field.

If( radioBtnCustomer.Selected.Value = "Contact",
    Sort(Distinct(Filter(Contacts,Status = 'Status (Contacts)'.Active),'Full Name'),
        Value,
        SortOrder.Ascending
    ),
    Sort(Distinct(Filter(Accounts,Status = 'Status (Accounts)'.Active),'Account Name'),
        Value,
        SortOrder.Ascending
    )
)

The result –

Also to clear the selection in the combo box when the user changes the option from contact to account and vice versa we can use the Reset function.

Check the below links to learn more about working with Customer lookup –

https://learn.microsoft.com/en-us/power-apps/maker/canvas-apps/working-with-references#show-the-columns-of-a-customer

Hope it helps..

Advertisements

Combo box showing blank values in case of multiple conditions – Canvas App (Dataverse)


Recently while trying to filter combo box Items we were getting the values but it was coming as blank instead of showing the name field.

Below is a sample Form – connected to Leads and Source Campaign is the combo box field (lookup to Campaign)

As we can see without applying the filter we can see the name (Display fields) populated.

Now let us try to filter it based on the Campaign Type field.

Here we have applied a single filter condition.

We can see the combo box getting filtered correctly.

Now we are introducing a variable just to filter it based on condition.

Till now filtering works as expected.

Now let us introduce else condition here.

We can see the combo box getting filtered but not showing the name field of the Campaign set as a display field. Through developer tools also, we don’t see the name returned in this case. The same is the case if we use multiple If or Switch in the formula.

The solution is to filter on Campaigns data source directly, instead of the corresponding Choice field in the Lead.

The result –

Hope it helps..

Advertisements

How to – Set Default value for the combo box in Canvas Apps (Dataverse)


Suppose we have the following Combo Box named Status bind to one of the choice fields of Dataverse.

Items = Asset Status option set field of table Product.

Now if we want Available to be the default selected value for it, we can use the DefaultSelectedItems property of the combo box.

DefaultSelectedItems = Filter(Choices(Products[@’Asset Status’]), Value = ‘Asset Status’.Available)

Also if we want to set the value of the Villages combo box based on the value selected in the Region combo box. The region is a lookup field in the Villages table.

We can update the Items property of the Villages combo box from

Villages (Data Source)

to

If(IsBlank(comboRegion.Selected),Villages, Filter(Villages, Region.Region = comboRegion.Selected.Region))

Hope it helps..

Advertisements