Show value of aggregation on table

Show value of aggregation on table

  

Assalamu'alaikum, 

Hi Everyone

I have been make the aggregate function, but i want to show he result in the table. So, do i have to add the atribute in the table and structure or what ?

i want to show the results of aggregate function in Posting entity (value SUM LikePosting from LikePosting Entity)

u can see this :

Please help me, 

Thanks.

You can put an aggregate and in the aggregate create a new attribute that is assigned to your function:

regards,

bb

Barong Bali wrote:

You can put an aggregate and in the aggregate create a new attribute that is assigned to your function:

regards,

bb

Hi Barong Bali,

how about the Advanced SQL for show that value ?

if any something wrong, please tell me.

Thanks

yes, it is correct. However, you should use aggregate, instead of PL SQL advance, unless the aggregate cannot do it (for example for bulk data deletion if you care about performance ):

- use aggregate as it is database independent (you do not need to change your code if the database change, say it from Oracle to SQL Server).

regards,

bb

I would agree with Barong Bali that you should rely on Aggregates if they can be used for your particular needs... SQL statements should be used only for advanced scenarios not supported by Aggregates, as they are much harder to maintain.

That being said, in SQL you can add the aggregation functions as part of your SELECT. This is standard SQL syntax, you can see several examples here. But in your example you would need to also GROUP BY the {Comment}.[Id], or it would not be available by the time the database engine evaluates the SELECT return values.

fahmi fachrurozi wrote:

Barong Bali wrote:

You can put an aggregate and in the aggregate create a new attribute that is assigned to your function:

regards,

bb

Hi Barong Bali,

how about the Advanced SQL for show that value ?

if any something wrong, please tell me.

Thanks


Hi Barong Bali, I want to show the aggregation value inside atribute JumlahComm :


how to write the sql to get the SUM of Comment and then show it in the atribute JumlahComm ?


hi, 

1. create a server action that returns the sum of comment, and make it function YES

2. in the aggregate... new attribute... edit formula, just call the function


regards,

bb

you just need to set your SQL to something similar to:

SELECT
    {Comment}.[Comment],
    {Comment}.[TimeStamp],
    {Comment}.[ProfileId],
    {Comment}.[PostingId],
    SUM({Comment}.[Id])
FROM
    {Comment}

Optionally, if you want your results sorted by some criteria add an ORDER BY clause, but only with the criteria you need, no point in adding all the attributes, given in your example it will first sort by Id, and none of the following columns will change the order in any way... 

but i want t show the value in the test output as JumlahComm, so do i have to add the structure or attribute ? i'm not really undestand. Sorry

hi Fahmi,

This is the Output?

I use aggregate instead of SQL Advance and call it in the JumlahComm, given a Title ID:


I attach the oml.

regards,

bb

Barong Bali wrote:

hi Fahmi,

This is the Output?

I use aggregate instead of SQL Advance and call it in the JumlahComm, given a Title ID:


I attach the oml.

regards,

bb

ok thank u Barong Bali


Hi All

I am sorry to open this up again, but I have a similar problem.


However, I want to store the result of the aggregate formula to the database and then have the result called up through a record retrieval. 

I have the latter portion in place, however, I need to have the results saved to the DB and the assign function is not doing the trick.   

hi Craig,

To save to database you only need to loop that list and use entity action like createLikePosting.

regards,

A