Hi
I'm currently learning about how to use PowerApps and I've stumbled upon a problem.
I have an EditForm with many fields that sometimes are blank and sometimes contains data.
I want to use BarCodes for the ID's, and i can get it working if it's a blank box, but i cant get it to show the old value.
Scenario:
This is the field and the button to activate "Set(ScannedCode1, ScanBarcode())"
Then i have "DataCardValue17" set to "ScannedCode1", which autofills with the value from the barcode.
The issue I'm having, is that i want to show the "Default.Parent" value first, and IF i scan a barcode, to replace the preentered text.
I experimented with UpdateIf and UpdateContext but couldn't quite figure out how to use them for this.
Anyone able to help? 🙂
Thanks!
Solved! Go to Solution.
I found a workaround.
On the Camera image, I've added the OnSelect to
UpdateContext({LaptopScan: ScanBarcode()}); UpdateContext({LaptopScanned: true})
then the DataCardValue17 (the edit box for the laptop id) i reference an If to ensure that only if we have a value in LaptopScan that it will load.
If(LaptopScanned, LaptopScan, Parent.Default)
This presented the issue that when going to the next person to add an ID to, it would autofill the data from the previous user, overwriting the Parent.Default that might already be present.
To fix this, I've added on the Cancel button
ResetForm(EditForm1);Back();UpdateContext({LaptopScanned: false})
and on the EditForm button when first going in to edit the user details
EditForm(EditForm1);Navigate(InventoryEdit, ScreenTransition.None); UpdateContext({LaptopScanned: false})
This fixed my issue. I feel there should be a more elegant solution but it works! 🙂
I also tried adding this code to the button OnSelect, but it comes up with an error:
"Set(DataCardValue17,ScanBarcode())"
I found a workaround.
On the Camera image, I've added the OnSelect to
UpdateContext({LaptopScan: ScanBarcode()}); UpdateContext({LaptopScanned: true})
then the DataCardValue17 (the edit box for the laptop id) i reference an If to ensure that only if we have a value in LaptopScan that it will load.
If(LaptopScanned, LaptopScan, Parent.Default)
This presented the issue that when going to the next person to add an ID to, it would autofill the data from the previous user, overwriting the Parent.Default that might already be present.
To fix this, I've added on the Cancel button
ResetForm(EditForm1);Back();UpdateContext({LaptopScanned: false})
and on the EditForm button when first going in to edit the user details
EditForm(EditForm1);Navigate(InventoryEdit, ScreenTransition.None); UpdateContext({LaptopScanned: false})
This fixed my issue. I feel there should be a more elegant solution but it works! 🙂
User | Count |
---|---|
194 | |
126 | |
89 | |
48 | |
42 |
User | Count |
---|---|
277 | |
162 | |
137 | |
81 | |
77 |