Working with list variables in general and specifically with pie charts

Working with list variables in general and specifically with pie charts

  

Hi All,

Firstly thanks for reading this, any help or guidance is much appreciated. I'm not an expert in OutSystems Studio but would describe myself as learning the ropes :-)

I have an implementation where my source data is being delivered to OutSystems through web services (REST to be exact). This is significant because in my understanding this mandates the data is in structure and variables and not in any aggregate.

Consequently,  processing of this list variables is key. In general the only toolset I am seeing to working with these list variable is a set of server actions

In relation to the first part of my question are there any other techniques for processing list variables that I am missing. I've been unsuccessful in manipulating lists variable in expressions. Am I missing somehting obvious?

Specifically I want to summarize the contents of my list variable in a pie chart. In the context of the movie demo data I have 100 movies with various attribute values defined in my list variable which originates from a sequence of REST calls.

I want my pie chart to summarize the number of movies by Genre. I cannot figure out hoe to process the list variable to deliver the required data to the pie chart

As I said I'm not an expert so the answer might be obvious to some but unfortunately not to me. Much of the documentation is focused on working with aggregates which unavailable to me since REST bypass aggregates and stay in memory. (maybe there is a way of passing REST data to an aggregate?)

In advance thanks for your time.

Solution

Hi Simon,

That's a long post, but I think it boils down to two questions:

  1. To calculate the sum of elements of a List, or do other things with a List, you use the For Each Statement: With the For Each, you can iterate over the List, and keep a running total. While iterating, each element is available as the .Current of the List.
  2. Storing the data in the database is of course a possibility, but I'd advise against it unless you want to keep the data for later use. If that's the case, For Each over the List, and save each element as a database Record. If that's what you need and need some guidance, feel free to ask.

Hope that helps.

Solution

Kilian Hekhuis wrote:

Hi Simon,

That's a long post, but I think it boils down to two questions:

  1. To calculate the sum of elements of a List, or do other things with a List, you use the For Each Statement:With the For Each, you can iterate over the List, and keep a running total. While iterating, each element is available as the .Current of the List.
  2. Storing the data in the database is of course a possibility, but I'd advise against it unless you want to keep the data for later use. If that's the case, For Each over the List, and save each element as a database Record. If that's what you need and need some guidance, feel free to ask.

Hope that helps.


I'll try this out, thanks for your quick response.

You're welcome. If you have any more questions let me know.