I have an edit form that has a ComboBox for selecting a State and entering a password. The SQL table that populates the Combobox looks like this:
workerState state password
T TAS 1234
V VIC 4567
If the user sets the State and Password correctly in their first login, then the state and password are saved on the local device.
ClearCollect(currentState, cmbState.Selected);
ClearCollect(statePassword,txtStatePassword.Text);
SaveData(currentState,"savedLastState");
SaveData(statePassword,"savedStatePassword");
In the Powerapps App OnStart event, I have:
/*load last state and password*/
LoadData(currentState,"savedLastState", true);
LoadData(statePassword,"savedStatePassword", true);
Then I test if the last selected state and it's password matches with the State and password from the newly downloaded SQL states table.
/*now check if state and password combo are correct*/
Set(statePasswordAccepted,Text(First(Filter(states, workerState = Left(First(currentState).state,1))).password)=First(statePassword).Value);
If the local state and password do not match with the SQL version I clear the state and password collections:
If(statePasswordAccepted=false,
Clear(currentState);
Clear(statePassword);
);
In the DefaultSelectedItems property, I have the following:
If(statePasswordAccepted,First(currentState))
This works correctly on the form when the user opens it the second time. The last state selected looks like it is selected and if the user just presses the Open button the app moves to the next form. BUT if the user clicks on the State's Combobox the screen goes Black. The Powerapp is still running but nothing is showing. If I press the back arrow on my mobile device, the app asks if I would like to close the Powerapp.
I thought it could be that the Combobox OnSelect code could be creating the issue so I deleted it but the issue continued and I still receiving the black screen of death when I selected the States Combobox.
Any thought would be greatly received.