Forum Academy Marketplace Showcase Pricing Features

Aggregate data into a text object

Hi everyone, I’m trying to build a custom analytics dashboard and am having a hard time figuring out how to aggregate a list of data into a single value to display in a text object.

I’ve defined a custom type called ‘Alert’ with fields ‘Triggered Time’ and ‘Claimed Time’. Given a list of alerts, I’d like to calculate Resolved - Claimed time for each item in the list, and then take the average of the list. The final aggregated value should be shown in a text object.

This is the closest that I’ve gotten, but this just computes the difference between the Resolved and Claimed times for a single value:

Is there a way to calculate this for all values and then take the average of them all? It seems like most solutions on this forum involve repeating groups, but I don’t think those will help me here since I’m not looking to actually display any of the intermediate values.

You want to create a list of values to average and store them as a custom state. The expression will be similar to the one you have showed but without the first items.

Thanks, understood on needing the intermediate state – I’m still not sure how to get there. How do I process this list into that custom state? The challenge is I need to calculate state1.x - state1.y and then store that in state2, for each item in state1.

Have you tried calculating the intermediate values in hidden input fields?

Unfortunately yes, the way that you build expressions doesn’t seem to be different for any of the elements so I don’t think it matters which element I use.

The fundamental issue is that I’m not seeing a way to do math on two fields in the same Thing for each item in a Thing list, and then store the resulting list of values somewhere else.

What about a different approach.

  1. create a number field in the Alert datatype called “difference”
  2. when the Resolved time is saved into the Alert, have a workflow that calculates the difference and saves it in the “difference” field
  3. Search for Alerts’ difference :average

Yeah I think that would work if the data were created within the app itself. I’m trying to build an analytics dashboard that pulls data from an API and displays it immediately when the page loads. That API doesn’t calculate the “difference” for us, and there’s no action that the user will take to trigger that calculation to occur. Might be that I have the wrong use case for Bubble.

In theory we could do some post processing on that data before storing it, but would be great to avoid that if at all possible.

A few months ago I have faced a problem in converting data into a text object then I need some information on the topic then cipd assignment writing help in dubai and cipd assignment help help out me and give assistance to me in solving my problems.