Is there any groupby function in stream analytics builder

What product/components do you use and which version/fix level are you on?

latest

Is your question related to the free trial, or to a production (customer) instance?

production

What are you trying to achieve? Please describe it in detail.

Is there any groupby component in the stream analytics builder

Do you get any error messages? Please provide a full error message screenshot and log file.

Have you installed all the latest fixes for the products and systems you are using?

latest

Can you explain your requirement more?

I want to query the operational database with Group by functionality.

The payload is in the JSON Format. Example payload:
{
Time: 2023-02-08 14:00:00,
Lot : 55649607,
Reason: No code,
Test_status: Rejected,
Quality : A
}

I want to groupby all the events with LoT number and then count the events with stream analytics builder.

https://cumulocity.com/api/10.15.0/#tag/Events

Check the documentation. Grouping isn’t available as such bu you should be able to use something like fragmentTyp/fragmentValue and withTotalPages to get the number of events.

The payload is in the JSON Format. Example payload stored in DB:
{
Time: 2023-02-08 14:00:00,
Lot : 55649607,
Reason: No code,
Test_status: Rejected,
Quality : A
},

{
Time: 2023-02-08 14:15:00,
Lot : 55649607,
Reason: “”,
Test_status: Passed,
Quality : B
}
My question is how to count the number of the specific Lot Number here in the example 55649607 happend. For example the total count of lot number 556490 happend is 2.

Can I achieve this by the stream anyalytics builder similar to the groupby statement and count() function?

See my answer above?

Hi,

Thank you for the response.I know, we can query using API. But I want to know if I can implement this logic with the below components.

Pretty sure you could extract the Lot property , test it with an Expression, and if true (matches the Lot you are interested in) increments a counter.

But you would have to have one model per Lot id, or a templated model where different Lot ids were input values for instances.

Can these blocks check if the lot id is already present in the DB and increment the counter to the last counted value because events of similar lot number come not subsequently.

For example, if the lot number 535 event happens at 10:00:00 am then count of 535 lot number equal to 1.
Next event could be lot number 631 event that happens at 10:01:00 am then count of 631lot number equal to 1.
Later event could be lot number 535 event happens at 10:29:00 am then count of the 535 lot number equal to 2.

Is this possible with stream analytics builder blocks?

Or simple groupby function once the events are stored in the DB.
every 1 hour
groupby by the lot number and count the number of events happend.

I don’t think AB blocks exist to do this, you would probably be better with a custom EPL.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.