Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
THRUST SERVICES & TOOLS
CLOUD EDITIONS
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Intelligence (Analytics)
Problem with joint dataset(scripteddataset + mysqldataset
doublehawk
Hi,
I have a scripted dataset with the following values and source:
result|resulttext
0____|unworked
1____|passed
2____|partially passed
3____|failed
4____|blocked
ON OPEN
cnt=0
ON FETCH
var myarr1 = new Array();
myarr1[0] = 0;
myarr1[1] = 1;
myarr1[2] = 2;
myarr1[3] = 3;
myarr1[4] = 4;
var myarr2 = new Array();
myarr2[0] = "unworked";
myarr2[1] = "passed";
myarr2[2] = "partially passed";
myarr2[3] = "failed";
myarr2[4] = "blocked";
var parmcount =myarr1.length;
while(cnt<parmcount)
{
row["result"] = myarr1[cnt];
row["resulttext"] = myarr2[cnt];
cnt++;
return true;
}
return true;
And I have a jdbc based datasource that looks for example as follows:
result|count(*)|resulttext
0____|5______|unworked
1____|121____|passed
3____|21_____|failed
SELECT count(*), testresults.result
FROM testcases, testresultsets, testresults
WHERE testresultsets.relatedws = ?
AND testresultsets.relatedtc = testcases.oid
AND testresultsets.active IS NOT NULL
AND testresults.relatedtestresultset = testresultsets.oid
AND testresults.islastresultforcomp IS NOT NULL
GROUP BY testresults.result
For a chart i also need the missing results 2 and 4 to be shown with 0 counts.
So I decided to combine them in a joint data set(left join):
result|resulttext______|result|count(*)|resulttext
0____|unworked______|0____|5______|unworked
1____|passed________|1____|121____|passed
2____|partially passed_|_____|0______|______
3____|failed__________|3____|21_____|failed
4____|blocked________|_____|0______|______
But there is the problem.
Each dataset individually works without problems and needs not more than 3 seconds for preview. In the joint-dataset-editor I try to preview the results, the progress information window pops up and the progress runs endless.
Also eclipse need nearly 100% prozessor load and I have to shoot up eclipse in the task manager.
Because Im a beginner in scripting in birt I guess the sourcecode above is the problem.
I also tried to combine a second scripted dataset(same values like the sql-dataset) with the first one with the same effect.
If you need the designfile for this problem let me know.
Hope someone can help me.
Find more posts tagged with
Comments
JasonW
I do not know if this will fix the problem but can you change the code to:
ON OPEN
cnt=0
myarr1 = new Array();
myarr1[0] = 0;
myarr1[1] = 1;
myarr1[2] = 2;
myarr1[3] = 3;
myarr1[4] = 4;
myarr2 = new Array();
myarr2[0] = "unworked";
myarr2[1] = "passed";
myarr2[2] = "partially passed";
myarr2[3] = "failed";
myarr2[4] = "blocked";
parmcount =myarr1.length;
ON FETCH
if(cnt<parmcount)
{
row["result"] = myarr1[cnt];
row["resulttext"] = myarr2[cnt];
cnt++;
return true;
}
return false;
If you do not return false the dataset will run forever.
Jason
doublehawk
Thank you very much for finging the bug in my code!
I will attach a designfile to this thread for beginners like me, which demostrates a joint dataset with two scripted datasets and a chart with exchanged colors by a script. I guess this will help some guys like me.