Create OutSystems Pie Chart
Question

How to create OutSystems Pie chart with group by clause. In Reactive web we have only option to use count, max, min but no option to use SUM on a particular field.

In my scenario I have a table as below:

TestTable 

(

ID as INT,

Status as VARCHAR(200),

Amount as VARCHAR(200)


In standard query we can use "SELECT SUM(CONVERT(FLOAT, ISNULL(Amount,0))), Status FROM TestTable  GROUP BY Status ", but In OutSystems Reactive UI neither I could change the query nor I am able to do the SUM operation.


Thanks,

Avijit 

Hi AVIJIT SARKAR,

The pie chart has only one mandatory attribute: a source data point list. The data Point sctructure is in Outsystems Charts module, inside Structure folder in Data tab.

So, to be able to generate the pie chart:

- make the calculations you must

- create a dataPoint list (using the structure DataPoint of Outsystems charts)

- append a new DataPoint in the list (in this point, you set the label and the value)

- select in the pie chart component the data point list as the Source Data Point List


You can set other parameters in the component, but doing this steps you have the basics.

mvp_badge
MVP

Hi,


I am confused by your title versus your question.

Your question is about how to do a SUM in an aggregate on a text-field, this has nothing to do with a pie-chart.

I do not think you can do it anyways in an aggregate, so in your case I would sticky to advanced sql.


Hi J,

I am sorry, I cant understand your response "adv. sql.".

Additionally I am unbale to incorporate the SQL in Pie chart and in Pie chart there is no option to use Sum as aggregate function.


Thanks,

Avijit 

mvp_badge
MVP

Sorry my bad,

Adv. sql is Advanced SQL. you cannot use that directly, and you will need to create a data-action for that, instead of an aggregate.

That said, a piechart just needs a dataset, which is a list of datapoint. It's irrelevant what the source is, as long as its a datapoint-list.


Hi J,


Could you please provide an example.


Thanks,

Avijit 

mvp_badge
MVP

I would suggest you try it first and if you get stuck again, you can also post your solution here and we take it from there.


I am able to to create a server side event and then assigned the SQL result to datapoint.

Now I am unable to assign the datapoint to pie chart 

You need to assign output of SQL to list of datapoint and assign this list to pie chart

Hi AVIJIT SARKAR,

The pie chart has only one mandatory attribute: a source data point list. The data Point sctructure is in Outsystems Charts module, inside Structure folder in Data tab.

So, to be able to generate the pie chart:

- make the calculations you must

- create a dataPoint list (using the structure DataPoint of Outsystems charts)

- append a new DataPoint in the list (in this point, you set the label and the value)

- select in the pie chart component the data point list as the Source Data Point List


You can set other parameters in the component, but doing this steps you have the basics.

Hi All ,

Thanks for the suggestions. The datapoint list is working as expected. But now I have problem with line chart.

I have data format as below 

 Year | Purchase Amount | Sales Amount

2005  | 1000                        | 20000

2006  | 4000                        | 10000

How to draw line chart using above data. 

      

Hi AVIJIT SARKAR,

May below link will help you

https://success.outsystems.com/Documentation/11/Reference/OutSystems_APIs/Charts_API/Create_Line_and_Area_Charts 

Regards,
Sharad Pawar

I have another problem in my bar chart. The data is showing but unable to set the X-axis value.


Untitled.png

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