It's all about the answers!

Ask a question

How to split BIRT parameter values


Tojan John (1171457) | asked Nov 27 '14, 12:03 p.m.
 Hi,
I am using BIRT 2.6.2 version. I am using cascading parameter and have three parameters to pass. Project area, Timeline and Iteration. Iteration is multi-selection. I need the ITERATION_ITEMID to be used in Javascript for data processing. But I am unable to get the multi-selected ITERATION_ITEMIDs. It is giving result as a single string with quotes (') and each ITERATION_ITEMID separated with commas (,). I am able to remove the quotes based on https://jazz.net/forum/questions/90236/how-to-enable-multi-select-parameters-in-birt-for-rtc-reporting . But still struggling to split the multiple ITERATION_ITEMIDs separated by comma. As mentioned in the link I used split, but giving some junk value. Basically I need to check the work item record against each ITERATION_ITEMID and if it matches I need to process. Any help on this is highly appreciated.

One answer



permanent link
Tadeusz Janasiewicz (105149) | answered Nov 27 '14, 6:42 p.m.
edited Nov 27 '14, 7:32 p.m.
Hi Tojan,

I think I had a similar issue in my case the name of the parameter was "GEO":

importPackage(Packages.java.util.*);

geosSet     = new java.util.HashSet();

try {
    geosTable     = params["GEO"].value.replace(/'/g,"").split(",");

 } catch (err) {     if ((params["GEO"].value.getClass().getName()) == "[Ljava.lang.Object;") {         geosTable = params["GEO"].value;     } else {         geosTable = params["GEO"].value.replace(/'/g,"").split(",");     }    }
// print the results
for (i=0; i < geosTable.length;i++) {
    geosSet.add(geosTable[i]);

    // Set the GEO label header
    if(i > 0)
        _GEO += " & ";

    _GEO += enums["Region"][geosTable[i]];
}
BTW what do you mean by "junk value"?

Best regards,
Tad

Comments
Tojan John commented Nov 28 '14, 3:12 a.m.

 Hi Tad,

Thanks for you help. Still I am getting same result. Iterations are appearing as "Ljava.lang.Object;@35233523" once I split.


Tadeusz Janasiewicz commented Nov 28 '14, 8:33 a.m.

Hi Tojan,

Are you able to share your report, *.rptdesign file?

Best regards,
Tad


Tadeusz Janasiewicz commented Dec 01 '14, 6:53 a.m. | edited Dec 01 '14, 6:57 a.m.

Hi Tojan,

Were you able to solved this issue?
Maybe you should use ITERATION_ID or ITERATION_NAME instead of ITERATION_ITEMID and check if this issue appears?

The results you mentioned suggest, that the cast is made in a wrong way.
Are you able to share with us how does your Data Set from which you are trying to get those values look like? (what is the data source, tables, parameters you used)
Also how is your Report Parameter built?

Best regards,
Tad

Your answer


Register or to post your answer.