Hallo All,
I have screen like this
For the first time this page is loaded will fetch aggregate "Name" from preperation and will showed in UI as table records, but I have 2 more data that should be fetched while I click the button. When I click button Address will fetched aggregate "Address", when I click button Age will fetched aggregate "Age".
I have tried to call three aggregate in preperation like this
But I don't want to do it like that because when the page is loaded it will feel heavy because it immediately calls 3 aggregates.
Is there another way if I want to fetch only the required aggregates?
Thanks
This way is more straightforward.
Just modify your preparation like this. Your logic stays the same.
Cheers,
Nam
Hi Kane Loony,
In Preparation, you only fetch aggregate "Name".
In TabClickEvent, you define an action to refresh data
For example, "Address", You create a local variable IsAddressFetched ( False as Default).
In the handle action for TabClickEvent :
if IsAddressFetched -> endelse :
IsAddressFetched = True;GEtdata;
Ajax refresh
Hi Nguyen,
Can you share more details what Tab Click Event? because i using button to fetch data and change table records
When I looked at your picture, I thought that you were using Tab Widget, So I suggested fetching data in TabClickEvent cause it is an event of Tab Widget.But then I realize that there is an easier way. you just ignore my first comment and focus on the second comment.
In the second comment, you only need to update the preparation as I mentioned above.
The If Clause is set to False
Cheers,Nam
When I set condition to false it's mean preperation just fetch 1 aggregate. My question is when I click button Age how can I fetch Age aggregate on preperation?
You refresh data (use the "refresh data" action), it is possible. Please try it and verify it yourself.
From my point of view and the scenario that you shared, I don't see why fetching all data at the preparation. You only need to fetch GetName. When you click the button Address, you fetch GetAddress and then change table records. The same thing with Age.The reason is I don't see the usage of GetAddress or GetAge when the screen renders its first time.Cheers,Nam
Awesome... your idea it's work like I want. I thought if I want to fetch data from aggregate, I have to enter flow in preparation, but it's not. by using the data refresh action I can also fetch data even though it is not included in the flow preparation.
Hello,
You can use a condition IsLoadingScreen().
After Name query you out a IF with this function, True goes to the end false will run the queries!
This function tell you if you are opening the screen for the first time.
Regards
Hi Paulo,
Can you share more details about IslLoadingScreen()
Hi @Kane Loony
As i understood, You only want to GetName aggregate in preparation,
Before that make sure you don't need other 2 aggregates data when screen load, fetching data in preparation means the data which required for initial view without any event triggered (i.e. OnClick or onChange)
So, GetAge and GetAddress not required initially and these data required after any event like click on any button then you can call these aggregate on you event handler,
Like there is a button Show Address so when you click this button a handler action called then you can put your GetAddress aggregate there and pass current person id to get address,
Or if you have relation between these 3 aggregate you can join these 3 together in a single aggregate also.
I hope it'll help you,
ThanksDeep
Hi Dubey,
You right!, First thing to do when UI loaded just get aggregate name, if click another button will get another aggregate another, so the first time UI is loaded it will feel light because it's only fetching 1 aggregate. But I really confused how to do this
Just remove GetAge and GetAddress aggregate from preparation, then Create 2 link or button in each row and pass GetName.current.youraggregate.id as input parameter in button or link onclick event handler screen action.
Then these action will give you address and age,
But my suggestion is that if you have relationship in all 3 tables then you can create only 1 aggregate and join them so you'll get all data.
I hope it'll help you.