Hi All
Please forgive my rudimentary speak (I've only started learning powerapps today)
I'm trying to build an app where staff can grab the next available PO number from a SQL table
I've added a toggle for the PO status (cancelled/not cancelled) and managed to patch it so it writes back to the SQL table, but it only works if the toggle is on the BrowseGallery screen. I'd really like to have it on the Details Screen though, but when I do 'ThisItem' doesn't go red in the formua bar?
Can we not use 'ThisItem' from the details screen?
Are there any other alternatives ways to do this?
Any help would be appreciated
Regards
Vicky
Solved! Go to Solution.
Hi Vicky,
'ThisItem' is valid syntax on a details form in a detail screen, provided that the control where you call the Patch function is contained within a Card that's inside the form. You can use the tree view in the left hand pane to find out exactly where a control is located.
To add controls to a Card, it's necessary to first unlock the card using the option in the Advanced section of the card.
By default, the data source of a detail form is set to BrowseGallery1.Selected. You can find this out by looking at the Item property of the detail form. Therefore, the formula you can use to patch the current record on a detail form will look something like this.
Patch('[dbo].[MobilePOLog]', BrowseGallery1.Selected, {StatusColumn: Toggle3.Value} )
Hope that helps.
Hi Vicky,
'ThisItem' is valid syntax on a details form in a detail screen, provided that the control where you call the Patch function is contained within a Card that's inside the form. You can use the tree view in the left hand pane to find out exactly where a control is located.
To add controls to a Card, it's necessary to first unlock the card using the option in the Advanced section of the card.
By default, the data source of a detail form is set to BrowseGallery1.Selected. You can find this out by looking at the Item property of the detail form. Therefore, the formula you can use to patch the current record on a detail form will look something like this.
Patch('[dbo].[MobilePOLog]', BrowseGallery1.Selected, {StatusColumn: Toggle3.Value} )
Hope that helps.
Not in a year of gogling would I have figured that out!
Thank you so much 🙂
One last question before I go - when I press the toggle to yes, the 3 dots go across the top of the screen, and my SQL table updates, but then the toggle mysteriously moves back to the 'no'position?
That means it then has to be pressed twice (back to yes, and then to no) to get it to update the SQL table back to a 'no'
Is it meant to behave like that?
--------------
EDIT: woops my bad. I assumed it was leaving the table correct, and it was only the toggle switch that apreared in the wrong position - but when the toggle is pressed it's actually updating the table to true, and then quickly back to false, just as the same as the toggle itself.
Oooof it's taken all night & morning & reading endless posts to figure how to stop the toggle resetting after the form is submitted, so hopefully this will help someone else:
1. Do what @timl says and put the toggle imside a datacard on the DetailForm1
2. Set the toggle Default to
If((ThisItem.StatusColumn) = true,true,false)
Replace 'StatusColumn' with the name of boolean column you wish the toggle to represent
3. Set the toggle OnSelect to
Patch('[dbo].[MobilePOLog]', BrowseGallery1.Selected, {StatusColumn: Toggle1.Value})
Same again, replace 'StatusColum' and dbo name for your own
This should keep your toggle in sync with your DB, and your DB in sync with your toggle! 🙂
I think!
User | Count |
---|---|
138 | |
132 | |
75 | |
74 | |
73 |
User | Count |
---|---|
206 | |
195 | |
70 | |
59 | |
52 |