Prevent If Widget Evaluating until Data is Returned

Prevent If Widget Evaluating until Data is Returned

  

I have an If widget on a page that displays different containers depending on whether the output parameter (IsAllowed) of a server action is True or False.

Because I have right-clicked the page and said 'Fetch Data From Other Sources' this contacts the database, and returns an output parameter of IsAllowed.

At the moment, the page, whilst loading the server action, displays the false branch on the page, and then when the parameter is returned as true, swaps over the content. What is the best way to prevent the display of the false branch before the IsAllowed parameter has been evaluated and returned from the server?

Solution

With a further look into this, the server action has a read only output called IsDataFetched.

I have put my If Widget inside an If Widget looking at  the IsDataFetched output and this seems to have done the trick!

Solution

Hi Russell,

You can enclose your If in another If and set the condition to 

FetchData.IsDataFetched


and either show a loading icon, or just simply an empty branch.

Edit: Guess you found the solution while i was posting :)


André Rodrigues wrote:

Hi Russell,

You can enclose your If in another If and set the condition to 

FetchData.IsDataFetched


and either show a loading icon, or just simply an empty branch.

Edit: Guess you found the solution while i was posting :)


Thanks Andre, I thought I had initially tried this, but it looks like I was looking at the IsFetched of a different aggregate, so after going back to the basics I was able to sort this as per OutSystems' already built tools.

I'll leave the post up though to help any beginners like me in the future :)