It's all about the answers!

Ask a question

BIRT Report: object not defined

Don Yang (7.7k21110138) | asked Sep 05 '14, 3:11 a.m.
edited Sep 05 '14, 3:12 a.m.
I am having RTC4.0.6 and following Help's BIRT install to install plugin.

I need to do something like:

Status       Severity1  sev2   sev3 sev4
open            1              0         3        1
in progress   0              2         1        0
closed          1              1          2        3

When using Cross Tab, I notice that I can only have one joint to show the names of status or severity, hence one will show as literal id instead of name.

Following the discussion in this post:

I tried to do step by step as per the videos but when I have one dataset as enumeration to show severity(customized enumeration) and another data set project area(exactly same as in the video).
When setting projectArea; to severity's parameter project area itemid's default value, it always complains projectArea is not defined hence failed to save.

If I simply set severity project area itemid parameter's default value as '{Current Project Name}', then continue by setting Object(), and mapping enumeration's Literal ID to Liternal Name(exactly following video 289, in the stage of create a computed Column, adding sev[row["STRING_VAL"]], if I run preview, it will complain sev is not defined(sev is the same as themes created in the video).

I am not sure what I am doing wrong. Does anyone know what could be the cause that the scripts do not work properly in my case?

Thank you very much.

4 answers

permanent link
Donald Nong (14.5k414) | answered Sep 08 '14, 1:37 a.m.
It may not be obvious in the video - you need to add a hidden field (those two Total.count() in the video) to load the data set along with the JavaScript object in it. The same technique is also described in this developerWorks article, if you prefer reading.

Don Yang commented Sep 08 '14, 2:02 a.m.

Thanks Donald for the link.
As you can see from my screenshots, I am pretty sure I have followed the videos and added Total.count() and javascript but the defined object can not be "seen" by other data set.

Don Yang commented Sep 08 '14, 3:32 a.m.

Thanks Donald. When moving Total.Count(); to top of cross tab table, step 9 to creating computed column works now. but step 5 and 6 still complains the projectArea not defined.

permanent link
Rafik Jaouani (5.0k16) | answered Sep 08 '14, 4:41 p.m.
Instead of specifying projectArea, use:
if (typeof(projectArea) == "undefined") {
} else {

You can also try initializing projectArea = null;      in the report body initialize method.

Donald Nong commented Sep 09 '14, 12:18 a.m.

Putting "projectArea = null;" in the "initialize" script of the report body resolved the ReferenceError, at least for me.

Don Yang commented Sep 09 '14, 2:06 a.m.

Thanks Rafik.
I tried the two ways and both work in report's preview.

permanent link
Rafik Jaouani (5.0k16) | answered Sep 05 '14, 8:22 a.m.
Don, can you please attach the BIRT report design to illustrate the problem. I am having a hard time understanding the issue.

permanent link
Don Yang (7.7k21110138) | answered Sep 07 '14, 9:32 p.m.
edited Sep 07 '14, 9:40 p.m.
Hi, Rafik

Thank you very much for the reply. I am providing the procedures I am trying following your videos to explain more(I cant  attach the design file here,  no option to do that. Since I have to add many screenshots, comments won't allow me to do that, have to use answer here)

1. Create Work item dataset for custom severity enumeration

2. create severity dataset

3. Project area dataset from Common data source

4. Define projectArea in the script for project area dataset

5. pass projectArea; to severity dataset

6. when clicking OK, it complains projectArea is not defined(which I did define but it is not able to pass from different dataset(from Project Area to severity)

(detailed errors:
A BIRT exception occurred.
  Plug-in Name:BIRT Data Engine
  Error Code:data.engine.UnexpectedError
  Error Message:Data engine operation failed due to an unexpected exception.
A BIRT exception occurred. See next exception for more information.
There are errors evaluating script "projectArea;":
ReferenceError: "projectArea" is not defined.

7. Now I set the default value of project area itemid in severity's parameter to '{Current Project Area}' to workaround the above error in order to move forward.
Create dynamic text to bind severity dataset, preview result looks ok.

8. Create new object and mapping following the instructions in the videos:

9.Create computed column in workitem dataset

10. It allows me to save but when previewing, it throws error that sev is not defined hence the computed column can not be computed. the problem seems to be similar to the previous projectArea not defined.

What did I do wrong in the above experiment? I follow the instructions in the videos although I do notice the BIRT version could be different. I installed the specified version in the 4.0.6 help. Please help. thanks a lot.

Don Yang commented Sep 07 '14, 9:49 p.m.

Workspace .log file only has:(repeated)
!ENTRY 4 1000 2014-09-08 10:17:39.412
!MESSAGE Long-running operations prohibited on this thread
java.lang.IllegalStateException: Long-running operations prohibited on this thread
    at com.sun.proxy.$Proxy27.fetchSnapshotDescriptorByName(Unknown Source)

Your answer

Register or to post your answer.

Dashboards and work items are no longer publicly available, so some links may be invalid. We now provide similar information through other means. Learn more here.