Data slot / data sheet refresh

I have screen and component where the component is storing data in data slots after the user enters info into text boxes and presses a button. These values are used to get data from a web service API to see whether they are valid. Then the user is directed to a different screen based on the validation.

So the button stores the data to the data slots then refreshes the data sheet and then there is a custom script to check a hidden value on the component that is linked to the value in the data sheet that is updated if the values are valid.

Here is the script:

if (this.props.adminuserid!=’-1’)
{
this.props.appActions.goToScreen(‘homepage’, { …this.props, transitionId: ‘fadeIn’ });
}

What happens, however, is that you have to push the button 2x in order for it to recognize that the hidden value (administered) has changed and direct the user to the right screen.

Is there a better way to do this? Or is there a change in the way the interactions / data refresh should work?

Hope that makes sense. Thanks for your help!

I’d probably need to see the project file to get better understanding of the “problem”. I’f guess that it has something to do with async data loading from server meaning that interactions are run but data is not there yet.

Anyway there are two things that i’d probably use instead of just custom script. I would use Switch block for routing the user to correct screen. In Switch block you can simply check data slot values and redirect user to different screens based on values.

Validator may also help you in case you simply want to check if user has inputted values before go to interaction.

Validator:

Switch:

Thanks - I was trying to send the values to a web api and check whether they were valid or not. So I guess I will have to write a script to do that directly as opposed to letting the datasheet refresh grab the information and check it.

As you note, it is no doubt a timing issue in that the results of the API call are not there.