I have a simple powerapp. The first screen the user chooses one of two options and the result is put in global variable named varoption and transferred to a second screen. On the second screen, the Visible property is set on two data table controls based on the global variable with the following code:
UpdateContext(locdt1Visible:false);
UpdateContext(locdt2Visible:false);
If (varoption = "test1", UpdateContext({locdt1Visible:true});
If (varoption = "test2", UpdateContext({locdt2Visible:true})
The first two lines are there to make sure Visible is set before the selection. locdt1 and 2 are local variables and hare in the Visible of each respective control.
I have tried to code this as a Select statement but that did not help.