I am trying to build a combobox with an If Statement, however it doesn't work as I have data coming from 2 different data source.
Both formula of the if statement works separately but not together.
is there a solution?
If(ToggleShipFrom.Value=false, Filter('REPORTING.V_IBP_POSSIBLE_LOC_REPUNIT', DESTPLANTDESCR= CBShipto.Selected.Result).SOURCEPLANTDESCR, RenameColumns('REPORTING.M_IBP_LOCATION'.LOCDESCR , "LOCDESCR", "Result"))
Solved! Go to Solution.
Tried this out. You can use collections to solve this. So, if you have a toggle, you can add to OnChange:
Add any filtering you need, so you get the items you require.
Then the combobox items would be:
If(ToggleShipFrom.Value=false; List1; List2)
Remember to add those collections also in Screen1 (or whatever screenname you have) -> OnVisible, so you'll have the collections ready when the app is started. The collections are updated with the toggle.
Hello @ilied84 ,
Thank you for the idea... unfortunatelly it doesn't work. The combobox is still blank. Any other idea ?
Thanks in advance,
It works for me. Maybe I explained it badly. Here's a more descriptive tutorial:
Code for my toggle. As you can see, i'm getting data from two different sources. The point is to get one column of data from that source and make it a collection. In my case, i'm getting a column called "Title" from one source and a column called "KP" from another source.
Code for my combobox. I simply check the value of the toggle, and fetch the collection (List1 and List2) based on the value.
End result, if the toggle is "true".
End result if the toggle is "false".
Hope this helps!
Nevermind, I think I know where the problem is. The problem is with this code:
Filter('REPORTING.V_IBP_POSSIBLE_LOC_REPUNIT', DESTPLANTDESCR= CBShipto.Selected.Result)
Power Apps is expecting a text, but that is not a text value. You can get around this by setting the selected result as a variable. So, select CBshipto combobox (or dropdown) and change the code in OnChange to this:
Then change the previous code to:
Filter('REPORTING.V_IBP_POSSIBLE_LOC_REPUNIT', DESTPLANTDESCR= ShipTo)
I think that will fix this.