Hi all
I'm trying to set the visibility on a data table column with an If statement based on what is selected in a combobox.
The following seemed logical, but doesn't work, and throws up a warning:
Oddly, it will work if I add an Or operator and second If statement referencing another combobox (with the true and else values of the second IF statement reversed):
In case you're wondering, I have checked that I'm referencing the comboboxes the right way around 😉
Any ideas?
Solved! Go to Solution.
Hey @Caroline
Have you changed the formula from what is shown in the first screenshot to:
If("Withdrawn learners" in FilterDropdown2_ReportsScrn.SelectedItems.Value,true,false)
This should work because FilterDropdown2_ReportsScrn.SelectedItems.Value returns a one-column list of all the selected items. Make sure that Value is the correct column to get these values.
Hope this Helps!
If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!
Hi @Caroline
You can set the Visible property of the column in the Data Table as:
If("Withdrawn learners" in FilterDropdown2_ReportsScrn.SelectedItems.Value,true,false)
Hope this Helps!
If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!
Hi @Caroline ,
Is this your original formula?
If(IsMatch(Concat(....),"...",conatins),"Withdrawn learners",true,false)
Could you describe the meaning of the red part?
The syntax of if statement should be like: If(formula,result1,result2)
While in your formula there has three results.
Please try this formula:
If(IsMatch(Concat(....),"...",conatins),true,false)
Here's a doc about if statement for your reference:
https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/functions/function-if
Best regards,
@yashag2255 thanks for the suggestion. That was my first go-to, but it only picks up the last item selected in the combobox.
@v-yutliu-msft thanks for looking at it. The "Withdrawn learners" is part of the syntax for the IsMatch statement.
As a simple If statement didn't get the desired result, I was trying to concat the combo box selected items, look for "Withdrawn learners" in the concatenation and return True/False, then set visible to True if IsMatch is True.
I'm thinking it's having the Concat statement nested in IsMatch that's the issue, any ideas?
Hey @Caroline
Can you please share more details about what do you mean when you say it only pick the last element? Are you trying to retrieve this?
Based on the current expression, it will look for "Withdrawn learners" in all the selected Items. If there is a deviation, please share more details about the configuration of the combobox control, so that we might be able to help you better.
Hope this Helps!
If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!
Hi @yashag2255
What I'm meaning is that it ignores all selected items except for the last one. In the screen shot on my last post, you can see that 'withdrawn learners' and 'email address' have been selected, but the 'withdrawn learners' column isn't visible in the table.
If they are selected the other way around, with 'withdrawn learners' as the last option selected, the column would be visible.
As I'll be setting the visibility of several columns with the same formula, I need it to find the phrase anywhere in the selecteditems.
What do you need on the combobox configuration that would help?
Hi @Caroline
The reason I wanted to know about the combobox configuration is to make sure that we are referencing to the correct column here.
Can you please confiem if you have used Combobox1.SelectedItems.Value instead of Combobox1.Selected.Value?
Expression:
If("Withdrawn learners" in FilterDropdown2_ReportsScrn.SelectedItems.Value,true,false)
Hope this Helps!
If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!
@yashag2255 Yes, definitely using selecteditems.
You can see the full formula in my initial post.
Cheers
Hey @Caroline
Have you changed the formula from what is shown in the first screenshot to:
If("Withdrawn learners" in FilterDropdown2_ReportsScrn.SelectedItems.Value,true,false)
This should work because FilterDropdown2_ReportsScrn.SelectedItems.Value returns a one-column list of all the selected items. Make sure that Value is the correct column to get these values.
Hope this Helps!
If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!
User | Count |
---|---|
229 | |
105 | |
93 | |
57 | |
30 |
User | Count |
---|---|
291 | |
119 | |
106 | |
62 | |
57 |