I have a bar code application in which I am selecting a prefix before that bar code and scanning the according to that code which is being scanned.
I have set up a switch statement but somehow it's not going into the else part/default part.
My code is here:
Switch(PrefixSelected.Selected.Title,
// if the user has selected (1S) and if he tries to scan a serial code, or any other code which does not match, it will show a popup, Not a 1S Code
"1S", Set(_NotISCode, !(PrefixSelected.Selected.Title = Left(BarcodeScanner2_5.Value,2))),
// if the user has selected (S) and if he tries to scan a serial code, or any other code which does not match, it will show a popup, Not a S Code enter code here
enter code here
"S", Set(_NotSerialCode, !(PrefixSelected.Selected.Title = Left(BarcodeScanner2_5.Value,1))),
// Is it a duplicate?
If(!IsEmpty(Filter('Barcodes - Test', BarcodeScanner2_5.Value = Title)),
Set(_DuplicateScan, true), // Duplicate Popup
// ELSE - Patch Command
UpdateContext({patchedRecord:
Patch('Barcodes - Test',
Defaults('Barcodes - Test'),
{
SerialCode:Right(BarcodeScanner2_5.Value,8),
Title:BarcodeScanner2_5.Value,
'Batch No': BatchSelection.Selected.Title,
ReceiveCheck: ToggleIssue.Value,
UserName:MyUser,
ReceivedSatus: "Yet To Receive",
When:Today() + Time(Hour(Now()), Minute(Now()),Second(Now()))
},
If(PrefixSelected.Selected.Title="1S",
{'Product Code': Mid(BarcodeScanner2_5.Value,3,10)},
{}
)
)
}
)
)
)
The code is showing the Above two Popups if I scan the wrong codes, but if I scan the correct codes it's not patching the values.
Where I am wrong here?