I have two fields:
Account code = text input
Account = combo box, linked to database table.
I have the following settings:
Account code
Default:
_accountCodeUpdate
OnChange:
UpdateContext({_accountCode: accountCode.Text})
Account:
DefaultSelectedItems:
Filter('[dbo].[accounts]', id = _accountCode)
OnChange:
UpdateContext({_accountCodeUpdate: accountSelect.Selected.id})
The purpose if the 2 fields here is that I want the Account Code to be where the user scans using a scanner a code, it will then update the combo box Account to the value as per the scanned code. The combo box acts as a backup, where code is not available to scan the user can look it up by search fields and it will update the Account Code text input once an account is selected.
Ideally, the scan code would go directly into the combo box but in testing it won't automatically select the item on scan and needs a second interaction to select the item from the filtered option.
What I would like to do is create a button that will clear both the Account Code text input and the Account combo box.
As they are both set with defaults looking at variables, I tried setting the button's OnSelect property as follows:
UpdateContext({_accountCode: "",_accountCodeUpdate: ""})
This resulted in red x's and did not work, it also broke the updating of the Account Code text input updating when an option is selected in the Combo Box manually.
Can anyone advise on how to maintain my looped connection between Account Code and Account, while also allowing me to reset these fields to blank?