Quantcast
Channel: Pentaho Community Forums
Viewing all articles
Browse latest Browse all 16689

Challenge with Variables while using Memory Group by.

$
0
0
Hi,

Thanks in advance for your support. Hope I have a challenging issue now. Let me explain it here.

The input file contains column STATUS having values either 10100, 10102 or 10103. Now using Memory group by function I need to find the count of rows for each status and set them as variable so that i can use it in some other transformation and I have done it. Please check the transformation attachment.

Example
Status Count
10100 10
10102 5
10103 2

To show the above statistics in a file, i am using the following java script,

CNT_10100 = getVariable("10100","0");
CNT_10102 = getVariable("10102","0");
CNT_10103 = getVariable("10103","0");




var statOutput=''


statOutput+='--------------------------------------------------------'+NL;
statOutput+='SUBSCRIBER COUNT (10100): '+ CNT_10100+NL;
statOutput+='SUBSCRIBER COUNT (10102): '+ CNT_10102+NL;
statOutput+='SUBSCRIBER COUNT (10103): '+ CNT_10103+NL;
statOutput+='--------------------------------------------------------'+NL;


The variable "statOutput" is send to next step to write it in a file.

I hope you have understood till this point.

The question here is, if there was an new status like 10104 or any other, then I need to update java script code.

Please, can you tell me how can this be done dynamically.
Attached Files

Viewing all articles
Browse latest Browse all 16689

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>