Agregation in report widget with collection is NOT working

139 views
Skip to first unread message

J.M.

unread,
Nov 15, 2016, 10:00:59 AM11/15/16
to Fujitsu RunMyProcess Developer Community
Hi,

I'm trying to make a report widget that shows only a part of the data I have in a collection. In order to do that, I'm doing something like this:

var my_pipelines = [
{
"$group" : {
"_id" : {
"subproducto" : "$subproducto",
"codigo" : "$codigo",
"stock" : "$stock"
}
}
},
{
"$project" : {
"SUBPRODUCTO" : "$_id.subproducto",
"CODIGO" : "$_id.codigo",
"STOCK" : "$_id.stock"
}
}
];

id_agregation.setAggregate(JSON.stringify(my_pipelines));
id_agregation.refresh();


where id_agregation is the id of the widget report.
For assuring that my pipelines are correct, I have added this code too, just below the previous code:


function callbackSuccess(result) {
console.log("OK " + JSON.stringify(result));
console.log(result);
}
function callbackFailure(result) {
console.log(result);
}

col_insumos.aggregateCallback(my_pipelines,{},callbackSuccess,callbackFailure);

The result of my query is something like that:
OK [{"SUBPRODUCTO":"ACUSE DE RECIBO","CODIGO":"N/A","STOCK":"N/A"},{"SUBPRODUCTO":"BOLSA SEGURISELLO","CODIGO":"N/A","STOCK":"N/A"},{"SUBPRODUCTO":"SOBRE","CODIGO":"EP-0046","STOCK":"473513"},{"SUBPRODUCTO":"WELCOME","CODIGO":"N/A","STOCK":"N/A"},{"SUBPRODUCTO":"FLYER","CODIGO":"N/A","STOCK":"N/A"},{"SUBPRODUCTO":"CONTENEDOR","CODIGO":"EP-0411","STOCK":"267094"},{"SUBPRODUCTO":"WELCOME","CODIGO":"EP-0351","STOCK":"26863"},{"SUBPRODUCTO":"SOBRE","CODIGO":"EP-0081","STOCK":"473531"},{"SUBPRODUCTO":"ETIQUETA","CODIGO":"EP-0188 02","STOCK":"1264749"},{"SUBPRODUCTO":"ETIQUETA","CODIGO":"EP-0423","STOCK":"1264731"},{"SUBPRODUCTO":"ACUSE DE RECIBO","CODIGO":"EP-0006","STOCK":"941928"},{"SUBPRODUCTO":"BOLSA SEGURISELLO","CODIGO":"TS-4290-1","STOCK":"851459"},{"SUBPRODUCTO":"FLYER","CODIGO":"EP-0425","STOCK":"115904"}]

...so my aggregation is getting results.
However, the widget report is showing as the attached image, which is clearly not correct.
I attach too the configuration of my widget array, which is including only the columns I want to see, that is, all the columns I wrote in the $project pipeline.
Please, note that the number of elements shown in the report in the attached image is 13, which is exactly the number of records that the query returns, so I think this could be a visualization error (I'm using Chrome).

Is there a bug in the widget report? Am I doing something wrong with the widget?

Kindly regards

widget_report_collection_aggregation.png
widget_report_configuration.png

Pankaj Kumar

unread,
Nov 16, 2016, 12:59:35 AM11/16/16
to Fujitsu RunMyProcess Developer Community
Hi,

In report, data is loaded however it seems you have not set up the column correctly. since your resulted object is
{"SUBPRODUCTO":"ACUSE DE RECIBO","CODIGO":"N/A","STOCK":"N/A"},{"SUBPRODUCTO":"BOLSA SEGURISELLO","CODIGO":"N/A","STOCK":"N/A"}

In Column configuration, please set property "SUBPRODUCTO"  instead of "subproducto" similarly CODIGO and STOCK instead of codigo and stock respectively.



Thank you,
Pankaj Kumar
Fujitsu RunMyProcess Support


--
Fujitsu - RunMyProcess
---
You received this message because you are subscribed to the Google Groups "Fujitsu RunMyProcess Developer Community" group.
To unsubscribe from this group and stop receiving emails from it, send an email to supportforum+unsubscribe@runmyprocess.com.
To post to this group, send email to suppor...@runmyprocess.com.
Visit this group at https://groups.google.com/a/runmyprocess.com/group/supportforum/.
To view this discussion on the web visit https://groups.google.com/a/runmyprocess.com/d/msgid/supportforum/af330b1a-e932-43ff-9c82-c0654d21c09a%40runmyprocess.com.
For more options, visit https://groups.google.com/a/runmyprocess.com/d/optout.

javiermm...@gmail.com

unread,
Nov 17, 2016, 6:42:06 AM11/17/16
to Fujitsu RunMyProcess Developer Community
Thak you Pankaj, it works

I think I missunderstood the setAggragate function. I thought it will set an aggregation over the data and it would do the mapping of the fields, so I though I should write the name of the collection field, wich is in lowercase.

Thank you again.
Regards.
> To unsubscribe from this group and stop receiving emails from it, send an email to supportforum...@runmyprocess.com.
Reply all
Reply to author
Forward
0 new messages