Is there a way to reference the current object using a 'this' reference or equivalent? Meaning I have 6 toggles that when OnCheck or OnUnCheck they add/remove their respective tooltip text to a collection. So the code is the same except for having to reference each toggle object by name. I was hoping there is a fast way to select all the toggles and do something like this in the OnCheck:
Collect( colToggleChoices, this.Tooltip )
where "this" refers to the current object. This way I don't have to select each toggle one at the time to edit the code.
Thanks for any info.
Solved! Go to Solution.
Hi @mattbrice ,
Currently, The "this" operator is not supported within PowerApps currently. If you want to select all the toggles and use "this" to reference current object (Toggle control), I afraid that there is no way to achieve your needs in PowerApps.
If you would like this feature to be added in PowerApps, please submit an idea to PowerApps Ideas Forum:
https://powerusers.microsoft.com/t5/PowerApps-Ideas/idb-p/PowerAppsIdeas
As an alternative solution, I think Gallery control and ThisItem operator could achieve your needs. I have made a test on my side, please take a try with the following workaround:
Add a Gallery control (Gallery1) within the screen of your app, set the Items property of the Gallery to following:
Table( {Name:"Toggle1", Tooltip:"First Toggle"}, {Name:"Toggle2", Tooltip:"Second Toggle"}, {Name:"Toggle3", Tooltip:"Third Toggle"}, {Name:"Toggle4", Tooltip:"Forth Toggle"}, {Name:"Toggle5", Tooltip:"Fifth Toggle"}, {Name:"Toggle6", Tooltip:"Sixth Toggle"} )
Within the Gallery, add a Label control and a Toggle control (Toggle1). Set the text property of the Label control to following:
ThisItem.Name
Set the Tooltip property of the Toggle control (Toggle1) to following:
ThisItem.Tooltip
Add one button outside the Gallery -- "OnCheck" button (on my side, it is called "Collect"). Set the OnSelect property of the "OnCheck" button to following:
ForAll(
Filter(Gallery1.AllItems, Toggle1.Value = true),
Collect(colToggleChoices, Toggle1.Tooltip)
)
After you checked the corresponding Toggle controls within the Gallery, click the "OnCheck" button, then the corresponding checked Toggle controls' Tooltip value would be saved into the colToggleChoices collection.
Note: You could also consider take a try to add a another button -- "UnCheck", to achieve your UnCheck logic as above.
Please check the attached GIF screenshot for more details:
Best regards,
Hi @mattbrice ,
Currently, The "this" operator is not supported within PowerApps currently. If you want to select all the toggles and use "this" to reference current object (Toggle control), I afraid that there is no way to achieve your needs in PowerApps.
If you would like this feature to be added in PowerApps, please submit an idea to PowerApps Ideas Forum:
https://powerusers.microsoft.com/t5/PowerApps-Ideas/idb-p/PowerAppsIdeas
As an alternative solution, I think Gallery control and ThisItem operator could achieve your needs. I have made a test on my side, please take a try with the following workaround:
Add a Gallery control (Gallery1) within the screen of your app, set the Items property of the Gallery to following:
Table( {Name:"Toggle1", Tooltip:"First Toggle"}, {Name:"Toggle2", Tooltip:"Second Toggle"}, {Name:"Toggle3", Tooltip:"Third Toggle"}, {Name:"Toggle4", Tooltip:"Forth Toggle"}, {Name:"Toggle5", Tooltip:"Fifth Toggle"}, {Name:"Toggle6", Tooltip:"Sixth Toggle"} )
Within the Gallery, add a Label control and a Toggle control (Toggle1). Set the text property of the Label control to following:
ThisItem.Name
Set the Tooltip property of the Toggle control (Toggle1) to following:
ThisItem.Tooltip
Add one button outside the Gallery -- "OnCheck" button (on my side, it is called "Collect"). Set the OnSelect property of the "OnCheck" button to following:
ForAll(
Filter(Gallery1.AllItems, Toggle1.Value = true),
Collect(colToggleChoices, Toggle1.Tooltip)
)
After you checked the corresponding Toggle controls within the Gallery, click the "OnCheck" button, then the corresponding checked Toggle controls' Tooltip value would be saved into the colToggleChoices collection.
Note: You could also consider take a try to add a another button -- "UnCheck", to achieve your UnCheck logic as above.
Please check the attached GIF screenshot for more details:
Best regards,
Going to just reply here with the links to some of the many idea posts that already exist for this. Please please upvote them so the PowerApps team considers implementing it.
https://powerusers.microsoft.com/t5/PowerApps-Ideas/Ability-to-reference-items-in-a-control-using-qu...
Thanks for the response as I am somewhat new to Powerapps and hadn't considered using a gallery which in my scenario might just work. Of course unfortunately the problem with a gallery is i can't free form place the toggle on the screen, but i might work around this. Thanks.
Hi @mattbrice ,
Based on the needs that you mentioned, I think the Gallery control may be the only available solution to achieve your needs.
The "this" operator is not supported within PowerApps currently, if you would lhike this feature to be added in PowerApps, please submit an idea to PowerApps Ideas Forum:
https://powerusers.microsoft.com/t5/PowerApps-Ideas/idb-p/PowerAppsIdeas
Please consider take a try with the alternative solution I mentioned above, then check if it could achieve your needs. If you have solved your problem, please go ahead to click "Accept as Solution" to identify this thread has been solved.
Please also check and see if the following video would help in your scenario:
https://www.youtube.com/watch?v=PBrtWL1RFDk
Best regards,
Yippie! It looks like the cavalry is coming. I.e. the "Self" keyword is now available in the preview channel.
See this thread for more info.
User | Count |
---|---|
165 | |
90 | |
72 | |
64 | |
62 |
User | Count |
---|---|
210 | |
152 | |
96 | |
86 | |
66 |