cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
repema01
Level: Powered On

Show multiple variables if value is true

Hello,

 

I've got some checkboxes in one of my Powerapps and in a later screen i would like to summarize and show the ones that are checked. I've created an if statement that i think is correct but i get stuck on how to show the checkboxes if they are checked.

 

Does anyone know how to show the name of the textboxes if they are checked? This is my if statement.

 

If(Or(Role_DM.Value);(Role_IE.Value);(Role_Mgr.Value);(Role_SD.Value);(Role_SD_1st.Value);(Role_SD_2nd.Value);(Role_TL.Value);true;false)

 

Oh! And this is an ifstatement in an HTML-Textbox summarizing info from several screens.

1 ACCEPTED SOLUTION

Accepted Solutions
repema01
Level: Powered On

Re: Show multiple variables if value is true

@mdevaney,

 

Just wanted to show what nailed it for me. The lines below is now showing my collection column values in my html textbox.

"<Table>"&
"<tr>"&
"<th>Department</th>"&
"<th>Role(s)</th>"&
"</tr>"&
"<tr>"&
"<td>"&Department.Selected.GroupName&"</td>"& "<td>"&Concat( EmpRoles, CheckboxText & "<br>" )&"</td>"&
"</tr>"&
"<tr>"&
"<td></td>"&
"</tr>"&
"<Table>

 

Thank you very much for giving me the advice before. Smiley Happy

View solution in original post

5 REPLIES 5
mdevaney
Level 8

Re: Show multiple variables if value is true

@repema01 

 

You can use the following code.  Note that I had to type in the Checkbox names manually.

 

If(Role_DM.Value,"DM","")&
If(Role_IE.Value,"IE","")&
If(Role_Mgr.Value,"Mgr","")&
If(Role_SD.Value,"SD","")&
If(Role_SD_1st.Value,"SD 1st","")&
If(Role_SD_2nd.Value,"SD 2nd","")&
If(Role_TL.Value,"TL","")

If you want each result on a new line do this instead.

 

If(Role_DM.Value,"DM<br>","")&
If(Role_IE.Value,"IE<br>","")&
If(Role_Mgr.Value,"Mgr<br>","")&
If(Role_SD.Value,"SD<br>","")&
If(Role_SD_1st.Value,"SD 1st<br>","")&
If(Role_SD_2nd.Value,"SD 2nd<br>","")&
If(Role_TL.Value,"TL","")

 

---

Please click "Accept as Solution" if my response helped to solve your issue so that others may find it more quickly.  If your thought the post was helpful please give it a "Thumbs Up."

repema01
Level: Powered On

Re: Show multiple variables if value is true

Thank you very much @mdevaney,

 

That works really well. Yesterday evening however I started wondering if I was asking the correct question and I don't think i did.

 

Since I will probably need to add and remove checkboxes from my PowerApps application in the future i think i need to add them to a collection when checking them instead. Then i'll show the collection instead. That way I just need to add new checkboxes and copy the collection code in the 'onCheck' variable from another checkbox to add it.

 

Again thank you very much for your time.

Peter

mdevaney
Level 8

Re: Show multiple variables if value is true

That’s a very good thought to ensure easy maintainability of your code. You are correct, a single column table stored within a collection will do what you require.
repema01
Level: Powered On

Re: Show multiple variables if value is true

@mdevaney,

 

Just wanted to show what nailed it for me. The lines below is now showing my collection column values in my html textbox.

"<Table>"&
"<tr>"&
"<th>Department</th>"&
"<th>Role(s)</th>"&
"</tr>"&
"<tr>"&
"<td>"&Department.Selected.GroupName&"</td>"& "<td>"&Concat( EmpRoles, CheckboxText & "<br>" )&"</td>"&
"</tr>"&
"<tr>"&
"<td></td>"&
"</tr>"&
"<Table>

 

Thank you very much for giving me the advice before. Smiley Happy

View solution in original post

Highlighted
mdevaney
Level 8

Re: Show multiple variables if value is true

@repema01
Im glad you were able to figure it out and I appreciate you taking the time to write me back. Having the solution here will be helpful in case someone else has the exact same issue.

Helpful resources

Announcements
thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Power Platform World Tour

Find out where you can attend!

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

Top Kudoed Authors
Users Online
Currently online: 113 members 5,170 guests
Please welcome our newest community members: