570
Views
7
Comments
Solved
Aggregate & Data Action
Question
Application Type
Reactive

Hi All,

please help with Answer.

I have one aggregate and one data action which one is running first?

As I tried by using by same database both are taking same time, Is it correct?

2023-10-21 19-42-11
Tousif Khan
Champion
Solution

HelloSo for the first question - which one is running first ?

When the fetch property of both the Aggregate and Data action is set to  At Start, We cannot say which one will run first and which will run second, It is an asynchronous process, so we can't say which one is going to be executed at first. It will run in random order. Either your data action will run first or your aggregate it is not fixed.

Your Second question -  Yes we can see both are taking the same time. Data action is used when we need to fetch data from Server Action, Rest/Soap API and from SQL Query . Aggregates are used to fetch data from database entities.
So as we know Aggregate return optimize query, so what does optimized means?
It means only attributes which is being used on the screen will be fetched.
But on the other hand, if you will use data action, you have to fetch all the attributes unless you manually decide which one to use via  Advance SQL Querry.
So give it a try with both.
Use Aggregate And Bind some attributes to screen , and use Data action and fetch all data
Then Compare them both.

Thanks
Tousif Khan

2024-01-09 08-05-30
Dipali Shrawane

Okay, thanks for the detailed Explanation.

2024-03-22 09-17-23
Chandra Vikas Sharma

Hi Dipali,

it's always depend upon the sequence. in which sequence you write. 

2024-01-09 08-05-30
Dipali Shrawane

If we are running both differently then?

you can go through below Oml what I have Done to analyze.

Demo.oml
2023-04-16 15-25-31
Krishnanand Pathak

Hi @Dipali Shrawane
Data Actions and client-side Aggregates concurrently start to fetch data after the Screen loads. 

Regards
Krishnanand Pathak

2024-01-09 08-05-30
Dipali Shrawane

If both are having same data then it will take same amount of time to fetch all records, right?


2023-10-21 19-42-11
Tousif Khan
Champion
Solution

HelloSo for the first question - which one is running first ?

When the fetch property of both the Aggregate and Data action is set to  At Start, We cannot say which one will run first and which will run second, It is an asynchronous process, so we can't say which one is going to be executed at first. It will run in random order. Either your data action will run first or your aggregate it is not fixed.

Your Second question -  Yes we can see both are taking the same time. Data action is used when we need to fetch data from Server Action, Rest/Soap API and from SQL Query . Aggregates are used to fetch data from database entities.
So as we know Aggregate return optimize query, so what does optimized means?
It means only attributes which is being used on the screen will be fetched.
But on the other hand, if you will use data action, you have to fetch all the attributes unless you manually decide which one to use via  Advance SQL Querry.
So give it a try with both.
Use Aggregate And Bind some attributes to screen , and use Data action and fetch all data
Then Compare them both.

Thanks
Tousif Khan

2024-01-09 08-05-30
Dipali Shrawane

Okay, thanks for the detailed Explanation.

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