Hi all,
I'm having trouble working out the correct syntax in PowerApps for what is effectively just a simple If condition.
Scenario:
In D365 CE, all Contacts will have a 'CustomerID' (text field). For example, Bob Smith may have a CustomerID of "SMITH123". This will always be a unique value and I guess I could use GUID, though I may need it to be a user friendly/memorable value.
If Bob Smith then turns up to an event and we scan his ID Badge, the barcode scan result will return 'SMITH123'.
All I want to do is check that 'SMITH123' is a valid scan, so write a True/False value to a new field called 'ValidScan'.
So,
I have a Canvas App with a barcode scan button and the results of the scan (barcodescanner1.value) gets stored in a variable called ScanResult.
At this stage I'm also putting the barcodescanner1.value in a field on the form so I can visually see the result front end.
I also have another field where I'm pulling in the CustomerID value using the CDS connection.
I will then have a field called 'Valid Scan' which will show True/False. (I'll use an input field for this so I can do something with the True/False value).
All I want to do is check to see if the scan result is an exact match with the value held in my CustomerID field.
So the logic is simple as I've set out below, but I can't quite crack this using the PowerApps functions.
If
BarcodeScanner1.value = CustomerID.value
Then
Set ValidScan = True
else
ValidScan = False
end
Many thanks,
Rob
Solved! Go to Solution.
Hi @RobMonkman ,
Do you want to pupulate the 'Valid Scan' field with true/false value based on the Barcode scanned result?
I have made a test on my side, please consider take a try with the following workaround:
Set the Defualt property of the 'Valid Scan' field in your Edit form to following:
If(
BarcodeScanner1.Value in 'YourCDSEntity'.CustomerID,
"True",
"False"
)
or
If(
BarcodeScanner1.Value = CustomerIDTextInputBox.Text, /* <-- CustomerIDTextInputBox represents the Text box in your Edit form to display the CustomerID value from your data source */
"True",
"False"
)
In addition, if you want to display a Boolean value within the 'ValidScan' field, please modify above formula as below:
If(
BarcodeScanner1.Value in 'YourCDSEntity'.CustomerID,
true,
false
)
Please consider take a try with above solution, then check if the issue is solved.
Best regards,
Hi @RobMonkman ,
Do you want to pupulate the 'Valid Scan' field with true/false value based on the Barcode scanned result?
I have made a test on my side, please consider take a try with the following workaround:
Set the Defualt property of the 'Valid Scan' field in your Edit form to following:
If(
BarcodeScanner1.Value in 'YourCDSEntity'.CustomerID,
"True",
"False"
)
or
If(
BarcodeScanner1.Value = CustomerIDTextInputBox.Text, /* <-- CustomerIDTextInputBox represents the Text box in your Edit form to display the CustomerID value from your data source */
"True",
"False"
)
In addition, if you want to display a Boolean value within the 'ValidScan' field, please modify above formula as below:
If(
BarcodeScanner1.Value in 'YourCDSEntity'.CustomerID,
true,
false
)
Please consider take a try with above solution, then check if the issue is solved.
Best regards,
User | Count |
---|---|
133 | |
125 | |
73 | |
70 | |
69 |
User | Count |
---|---|
203 | |
201 | |
64 | |
63 | |
52 |