18
Views
4
Comments
Solved
Timing of rendering : Expression with text + data from aggregate
Application Type
Reactive
Service Studio Version
11.54.41 (Build 63060)

I have an Expression with:

" (" + GetSongs.List.Current.Songs.Artist + ")"

When the screen is loading, there's a fraction of a second where only the parentheses are displayed (since the aggregate information is still being retrieved), before the final result is shown:

How can I avoid that initial render with just the "()"?

2023-12-28 15-13-10
Mauro Alviza
Solution

Yes of course, I applied in the widget just for you to understand the logic. But normally it is applied just in the table. 


One tip for the “cleaner” part, you can use the IsDataFetched Output to do the If, and in the false branch, you add a container with the class “lis-updating”, then, if the table is not fetched yet, it will show a loading icon for the user to know that the data is being fetched.

In the true branch of that If, you put a second If, but with the Output IsEmpty of the aggregate as a condition. In the true branch of that second if, you put a container with the “list-empty” class, that container will show a text that says “There is no items to show”. In the false branch, you put your table.


In that way, you can allways tell your user when the list is fetching, when it’s empty, and will show the data only when it’s fetched. Way cleaner 😎


Cheers.

2023-12-28 15-13-10
Mauro Alviza

Hi Paulo! :)

You can do that by hiding the expression while the data is not fetched yet with an if. When we are fetching data from an aggregate or a data action, is a good pratcice to hide the content while the data is not fetched, so things like that don't happen. 

Something like this:

In th

In the condition of the If, use the IsDataFetched output of your aggregate or data action.

Hope it helps!

Cheers.

UserImage.jpg
Paulo Sousa

Thank you very much, Mauro!

It works, but to avoid having to apply this to every needed widget, is there any way (such as a Screen general setting) to show nothing on the screen until all data is fetched?

(of course, I could put all the Screen elements within one "big" If, and give it that IsDataFetched condition... but I was hoping there was a "cleaner" way to do it).

Cheers!

2023-12-28 15-13-10
Mauro Alviza
Solution

Yes of course, I applied in the widget just for you to understand the logic. But normally it is applied just in the table. 


One tip for the “cleaner” part, you can use the IsDataFetched Output to do the If, and in the false branch, you add a container with the class “lis-updating”, then, if the table is not fetched yet, it will show a loading icon for the user to know that the data is being fetched.

In the true branch of that If, you put a second If, but with the Output IsEmpty of the aggregate as a condition. In the true branch of that second if, you put a container with the “list-empty” class, that container will show a text that says “There is no items to show”. In the false branch, you put your table.


In that way, you can allways tell your user when the list is fetching, when it’s empty, and will show the data only when it’s fetched. Way cleaner 😎


Cheers.

UserImage.jpg
Paulo Sousa

That's awesome, Mauro!! All great tips - loved the "list-updating" functionality, in particular. Thank you very much once again.

Cheers!

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.