Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » BIRT » Scope of the variables (how to report values modified in the onRow method )
Scope of the variables (how to report values modified in the onRow method ) [message #75425] Mon, 19 September 2005 09:03 Go to next message
Eclipse UserFriend
Originally posted by: gilles.vandaele.advalvas.be

Hi,
I have to compute data from each row of a table, and render it in my
report.
As I've declared a <code>var myVar=0</code> in the initialize() method of
the report, I modify it in the onRow() of my table (actually it is a table
group).
And if the expression of the element is <code>"myVar= "+myVar</code>, I
expect to view on my report, the value modified in the onRow()...
The value shown is the one initialized in initialize()!
Where am I wrong? What is the scopes hierarchy? What if I had modify the
var in the onFinish()? Where do I need to put code to work with value
retrieved from the rows and to be shown in the footer of the table group?
I can't find an example deeling with onStart(), onRow() and onFinish() on
value to be shown in the report.
Thanks
Gilles
Re: Scope of the variables (how to report values modified in the onRow method ) [message #75556 is a reply to message #75425] Mon, 19 September 2005 14:56 Go to previous messageGo to next message
Jason Weathersby is currently offline Jason WeathersbyFriend
Messages: 9167
Registered: July 2009
Senior Member

Gilles
I did a similar example, but I was totaling row counts for each item in the
group and would display this in the group footer. So I put var testcount =
1; in my initialize method and in the on row method Incremented the count
like testcount = testcount + 1;
In the group footer I added a data control with the expression set to the
following.
var test = testcount;
testcount = 1;
test;

The expression builder will return the last value used.
I am not sure if this is what you are looking for, but I dont understand
the "myVar="+myVar piece of code. If you use var variablename in the onRow
method its scoped only for that method. If you use it it the initialize I
believe it is scoped for the entire report run.

Jason Weathersby
BIRT PMC

"Gilles Vandaele" <gilles.vandaele@advalvas.be> wrote in message
news:566dd09f07a9d08e7b2ef0168389f57d$1@www.eclipse.org...
> Hi,
> I have to compute data from each row of a table, and render it in my
> report.
> As I've declared a <code>var myVar=0</code> in the initialize() method of
> the report, I modify it in the onRow() of my table (actually it is a table
> group).
> And if the expression of the element is <code>"myVar= "+myVar</code>, I
> expect to view on my report, the value modified in the onRow()...
> The value shown is the one initialized in initialize()!
> Where am I wrong? What is the scopes hierarchy? What if I had modify the
> var in the onFinish()? Where do I need to put code to work with value
> retrieved from the rows and to be shown in the footer of the table group?
> I can't find an example deeling with onStart(), onRow() and onFinish() on
> value to be shown in the report. Thanks Gilles
>
Re: Scope of the variables (how to report values modified in the onRow method ) [message #75779 is a reply to message #75556] Tue, 20 September 2005 10:16 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: gilles.vandaele.advalvas.be

I just putted your code into my report: the 'test' variable shown in the
group footer is at '1' !?!!...?
(the "myVar="+myVar piece of code was just a concatenation to show 'myVar'
in a string.)

Let's try with a new blank report:
I make a new Data source, a new Data set (from a flat file)
I put a table on the report
I add a group on the table
In initialize():
var testcountT = 0;
var testcountG = 0;

In the onRow() of my table:
testcountT = testcountT + 1;

In the onRow() of my TableGroup:
testcountG = testcountG + 1;

In the report hereunder, the '2,3,13,12' are the results of a data element
with expression 'Total.count()' in the group footer;
the '30' is the result of a data element with expression 'Total.count()'
in the table footer;
the '0,0,0,0'(?!?) are the results of a data element in the group footer
with expression :

var testG = testcountG;
testcountG = 0;
testG;

and the '26'(?!?) is the result of a data element in the table footer with
expression:

var testT = testcountT;
testcountT = 0;
testT;



You see here under the report:


transition user totalTime
AutoBOOffer_Broker DLHO773 985
AutoBOOffer_Broker DJVR335 1234
2 0
AutoBOOffer_Guarantees DLHO773 891
AutoBOOffer_Guarantees DJVR335 719
AutoBOOffer_Guarantees DEMO188 1609
3 0
AutoBOOffer_Premium DMBE098 4172
AutoBOOffer_Premium DADU237 5600
AutoBOOffer_Premium DAPA773 4547
AutoBOOffer_Premium DMOS844 3922
AutoBOOffer_Premium DSAV613 7961
AutoBOOffer_Premium DJME971 11359
AutoBOOffer_Premium DJME971 3000
AutoBOOffer_Premium DPGE475 9578
AutoBOOffer_Premium DLHO773 5078
AutoBOOffer_Premium DACL354 5203
AutoBOOffer_Premium DJVR335 3860
AutoBOOffer_Premium DCNI465 3047
AutoBOOffer_Premium DEMO188 4250
13 0
AutoBOOffer_Summary DMBE708 9031
AutoBOOffer_Summary DMBE708 2391
AutoBOOffer_Summary DJCA717 4422
AutoBOOffer_Summary DJCA717 1890
AutoBOOffer_Summary DMIJ601 7938
AutoBOOffer_Summary DMBE098 4985
AutoBOOffer_Summary DMOS844 8984
AutoBOOffer_Summary DJME971 9500
AutoBOOffer_Summary DPGE475 5031
AutoBOOffer_Summary DLHO773 8829
AutoBOOffer_Summary DJVR335 6297
AutoBOOffer_Summary DCNI465 5734
12 0
30 26


I don't understand the '0,0,0,0' and the '26'.
When are the Table.onRow() and the TableGroup.onRow() called?
Could you send me your rptdesign file?
Thanks,
Gilles
Re: Scope of the variables (how to report values modified in the onRow method ) [message #75899 is a reply to message #75779] Tue, 20 September 2005 14:18 Go to previous messageGo to next message
Jason Weathersby is currently offline Jason WeathersbyFriend
Messages: 9167
Registered: July 2009
Senior Member

Gilles,

Attached is my report design file.
Can you attach yours and let me look at it?
What version of BIRT are you using?

Jason Weathersby
BIRT PMC

"Gilles Vandaele" <gilles.vandaele@advalvas.be> wrote in message
news:e6652061397a8b795413340f6f0ecab5$1@www.eclipse.org...
>I just putted your code into my report: the 'test' variable shown in the
> group footer is at '1' !?!!...?
> (the "myVar="+myVar piece of code was just a concatenation to show 'myVar'
> in a string.)
>
> Let's try with a new blank report:
> I make a new Data source, a new Data set (from a flat file)
> I put a table on the report
> I add a group on the table
> In initialize():
> var testcountT = 0;
> var testcountG = 0;
>
> In the onRow() of my table:
> testcountT = testcountT + 1;
>
> In the onRow() of my TableGroup:
> testcountG = testcountG + 1;
>
> In the report hereunder, the '2,3,13,12' are the results of a data element
> with expression 'Total.count()' in the group footer;
> the '30' is the result of a data element with expression 'Total.count()'
> in the table footer;
> the '0,0,0,0'(?!?) are the results of a data element in the group footer
> with expression :
>
> var testG = testcountG;
> testcountG = 0;
> testG;
>
> and the '26'(?!?) is the result of a data element in the table footer with
> expression:
>
> var testT = testcountT;
> testcountT = 0;
> testT;
>
>
>
> You see here under the report:
>
>
> transition user totalTime
> AutoBOOffer_Broker DLHO773 985
> AutoBOOffer_Broker DJVR335 1234
> 2 0
> AutoBOOffer_Guarantees DLHO773 891
> AutoBOOffer_Guarantees DJVR335 719
> AutoBOOffer_Guarantees DEMO188 1609
> 3 0
> AutoBOOffer_Premium DMBE098 4172
> AutoBOOffer_Premium DADU237 5600
> AutoBOOffer_Premium DAPA773 4547
> AutoBOOffer_Premium DMOS844 3922
> AutoBOOffer_Premium DSAV613 7961
> AutoBOOffer_Premium DJME971 11359
> AutoBOOffer_Premium DJME971 3000
> AutoBOOffer_Premium DPGE475 9578
> AutoBOOffer_Premium DLHO773 5078
> AutoBOOffer_Premium DACL354 5203
> AutoBOOffer_Premium DJVR335 3860
> AutoBOOffer_Premium DCNI465 3047
> AutoBOOffer_Premium DEMO188 4250
> 13 0
> AutoBOOffer_Summary DMBE708 9031
> AutoBOOffer_Summary DMBE708 2391
> AutoBOOffer_Summary DJCA717 4422
> AutoBOOffer_Summary DJCA717 1890
> AutoBOOffer_Summary DMIJ601 7938
> AutoBOOffer_Summary DMBE098 4985
> AutoBOOffer_Summary DMOS844 8984
> AutoBOOffer_Summary DJME971 9500
> AutoBOOffer_Summary DPGE475 5031
> AutoBOOffer_Summary DLHO773 8829
> AutoBOOffer_Summary DJVR335 6297
> AutoBOOffer_Summary DCNI465 5734
> 12 0
> 30 26
>
>
> I don't understand the '0,0,0,0' and the '26'.
> When are the Table.onRow() and the TableGroup.onRow() called?
> Could you send me your rptdesign file?
> Thanks,
> Gilles
>
>
>


Re: Scope of the variables (how to report values modified in the onRow method ) [message #76107 is a reply to message #75899] Wed, 21 September 2005 07:32 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: gilles.vandaele.advalvas.be

Jason Weathersby wrote:

> Gilles,

> Attached is my report design file.
> Can you attach yours and let me look at it?
> What version of BIRT are you using?

> Jason Weathersby
> BIRT PMC

> "Gilles Vandaele" <gilles.vandaele@advalvas.be> wrote in message
> news:e6652061397a8b795413340f6f0ecab5$1@www.eclipse.org...
>>I just putted your code into my report: the 'test' variable shown in the
>> group footer is at '1' !?!!...?
>> (the "myVar="+myVar piece of code was just a concatenation to show 'myVar'
>> in a string.)
>>
>> Let's try with a new blank report:
>> I make a new Data source, a new Data set (from a flat file)
>> I put a table on the report
>> I add a group on the table
>> In initialize():
>> var testcountT = 0;
>> var testcountG = 0;
>>
>> In the onRow() of my table:
>> testcountT = testcountT + 1;
>>
>> In the onRow() of my TableGroup:
>> testcountG = testcountG + 1;
>>
>> In the report hereunder, the '2,3,13,12' are the results of a data element
>> with expression 'Total.count()' in the group footer;
>> the '30' is the result of a data element with expression 'Total.count()'
>> in the table footer;
>> the '0,0,0,0'(?!?) are the results of a data element in the group footer
>> with expression :
>>
>> var testG = testcountG;
>> testcountG = 0;
>> testG;
>>
>> and the '26'(?!?) is the result of a data element in the table footer with
>> expression:
>>
>> var testT = testcountT;
>> testcountT = 0;
>> testT;
>>
>>
>>
>> You see here under the report:
>>
>>
>> transition user totalTime
>> AutoBOOffer_Broker DLHO773 985
>> AutoBOOffer_Broker DJVR335 1234
>> 2 0
>> AutoBOOffer_Guarantees DLHO773 891
>> AutoBOOffer_Guarantees DJVR335 719
>> AutoBOOffer_Guarantees DEMO188 1609
>> 3 0
>> AutoBOOffer_Premium DMBE098 4172
>> AutoBOOffer_Premium DADU237 5600
>> AutoBOOffer_Premium DAPA773 4547
>> AutoBOOffer_Premium DMOS844 3922
>> AutoBOOffer_Premium DSAV613 7961
>> AutoBOOffer_Premium DJME971 11359
>> AutoBOOffer_Premium DJME971 3000
>> AutoBOOffer_Premium DPGE475 9578
>> AutoBOOffer_Premium DLHO773 5078
>> AutoBOOffer_Premium DACL354 5203
>> AutoBOOffer_Premium DJVR335 3860
>> AutoBOOffer_Premium DCNI465 3047
>> AutoBOOffer_Premium DEMO188 4250
>> 13 0
>> AutoBOOffer_Summary DMBE708 9031
>> AutoBOOffer_Summary DMBE708 2391
>> AutoBOOffer_Summary DJCA717 4422
>> AutoBOOffer_Summary DJCA717 1890
>> AutoBOOffer_Summary DMIJ601 7938
>> AutoBOOffer_Summary DMBE098 4985
>> AutoBOOffer_Summary DMOS844 8984
>> AutoBOOffer_Summary DJME971 9500
>> AutoBOOffer_Summary DPGE475 5031
>> AutoBOOffer_Summary DLHO773 8829
>> AutoBOOffer_Summary DJVR335 6297
>> AutoBOOffer_Summary DCNI465 5734
>> 12 0
>> 30 26
>>
>>
>> I don't understand the '0,0,0,0' and the '26'.
>> When are the Table.onRow() and the TableGroup.onRow() called?
>> Could you send me your rptdesign file?
>> Thanks,
>> Gilles
>>
>>
>>


> begin 666 grpfooter.rptdesign
> M/#]X;6P@=F5R<VEO;CTB,2XP(B!E;F-O9&EN9STB551&+3@B/SX-"CPA+2T@
> M5W)I='1E;B!B>2!%8VQI<'-E($))4E0@,2XP("TM/@T*/')E<&]R= "!X;6QN
> M<STB(&AT=' Z+R]W=W<N96-L:7!S92YO<F<O8FER="R,# U+V1E<VEG;B(@
> M=F5R<VEO;CTB,B(^#0H@(" @/'!R;W!E<G1Y(&YA;64](F-R96%T961">2(^
> M16-L:7!S92!"25)4($1E<VEG;F5R(%9E<G-I;VX@,2XP+C$@0G5I;&0@)FQT
> M.S(P,#4P-S(Y+3 W-#8^/"]P<F]P97)T>3X-"B @(" <')O<&5R='D@;F%M
> M93TB=6YI=',B/FEN/"]P<F]P97)T>3X-"B @(" ;65T:&]D(&YA;64](FEN
> M:71I86QI>F4B/CPA6T-$051!6W9A<B!T97-T8V]U;G0],3M=73X+VUE=&AO
> M9#X-"B @(" 9&%T82US;W5R8V5S/@T*(" @(" @(" ;V1A+61A=&$M<V]U
> M<F-E(&5X=&5N<VEO;DE$/2)O<F<N96-L:7!S92YB:7)T+G)E <&]R="YD871A
> M+F]D82YS86UP;&5D8B(@;F%M93TB1&%T82!3;W5R8V4B+SX-"B @(" +V1A
> M=&$M<V]U<F-E<SX-"B @(" 9&%T82US971S/@T*(" @(" @(" ;V1A+61A
> M=&$M<V5T(&5X=&5N<VEO;DE$/2)O<F<N96-L:7!S92YB:7)T+G)E <&]R="YD
> M871A+F]D82YJ9&)C+DID8F-396QE8W1$871A4V5T(B!N86UE/2)$871 A(%-E
> M="(^#0H@(" @(" @(" @(" <')O<&5R='D@;F%M93TB9&%T85-O=7)C92(^
> M1&%T82!3;W5R8V4+W!R;W!E<G1Y/@T*(" @(" @(" @(" @/'!R;W!E<G1Y
> M(&YA;64](G%U97)Y5&5X="(^<V5L96-T("H*9G)O;2!C=7-T;VUE <G,+W!R
> M;W!E<G1Y/@T*(" @(" @(" +V]D82UD871A+7-E=#X-"B @(" +V1A=&$M
> M<V5T<SX-"B @(" <&%G92US971U<#X-"B @(" @(" @/'-I;7!L92UM87-T
> M97(M<&%G92!N86UE/2)3:6UP;&4@36%S=&5R4&%G92(^#0H@(" @(" @(" @
> M(" <&%G92UF;V]T97(^#0H@(" @(" @(" @(" @(" @/'1E>'0^#0H@(" @
> M(" @(" @(" @(" @(" @(#QP<F]P97)T>2!N86UE/2)C;VYT96YT5'EP92(^
> M:'1M;#PO<')O<&5R='D^#0H@(" @(" @(" @(" @(" @(" @(#QT97AT+7!R
> M;W!E<G1Y(&YA;64](F-O;G1E;G0B/CPA6T-$051!6SQV86QU92UO9CYN97 <@
> M1&%T92@I/"]V86QU92UO9CY=73X+W1E>'0M<')O<&5R='D^#0H@(" @(" @
> M(" @(" @(" @/"]T97AT/@T*(" @(" @(" @(" @/"]P86=E+69O;W1E<CX-
> M"B @(" @(" @/"]S:6UP;&4M;6%S=&5R+7!A9V4^#0H@(" @/"]P86=E+7-E
> M='5P/@T*(" @(#QB;V1Y/@T*(" @(" @(" =&%B;&4^#0H@(" @(" @(" @
> M(" <')O<&5R='D@;F%M93TB=VED=&@B/C$P,"4+W!R;W!E<G1Y/@T*( " @
> M(" @(" @(" @/'!R;W!E<G1Y(&YA;64](F1A=&%3970B/D1A=&$@4V5T/"]P
> M<F]P97)T>3X-"B @(" @(" @(" @(#QM971H;V0@;F%M93TB;VY2;W<B/CPA
> M6T-$051!6W1E<W1C;W5N=" ]('1E<W1C;W5N=" K(#$[75T^/"]M971H;V0^
> M#0H@(" @(" @(" @(" 8V]L=6UN+SX-"B @(" @(" @(" @(#QC;VQU;6XO
> M/@T*(" @(" @(" @(" @/&-O;'5M;B^#0H@(" @(" @(" @(" :&5A9&5R
> M/@T*(" @(" @(" @(" @(" @(#QR;W<^#0H@(" @(" @(" @(" @(" @(" @
> M(#QC96QL/@T*(" @(" @(" @(" @(" @(" @(" @(" @/&QA8F5L/@T*(" @
> M(" @(" @(" @(" @(" @(" @(" @(" @(#QT97AT+7!R;W!E<G1Y(&YA;64]
> M(G1E>'0B/D-54U1/34523E5-0D52/"]T97AT+7!R;W!E<G1Y/@T*(" @(" @
> M(" @(" @(" @(" @(" @(" @/"]L86)E;#X-"B @(" @(" @(" @(" @(" @
> M(" @/"]C96QL/@T*(" @(" @(" @(" @(" @(" @(" 8V5L;#X-"B @(" @
> M(" @(" @(" @(" @(" @(" @(#QL86)E;#X-"B @(" @(" @(" @(" @(" @
> M(" @(" @(" @(" =&5X="UP<F]P97)T>2!N86UE/2)T97AT(CY#55-43TU%
> M4DY!344+W1E>'0M<')O<&5R='D^#0H@(" @(" @(" @(" @(" @(" @(" @
> M(" +VQA8F5L/@T*(" @(" @(" @(" @(" @(" @(" +V-E;&P^#0H@(" @
> M(" @(" @(" @(" @(" @(#QC96QL/@T*(" @(" @(" @(" @(" @(" @(" @
> M(" @/&QA8F5L/@T*(" @(" @(" @(" @(" @(" @(" @(" @(" @(#QT97AT
> M+7!R;W!E<G1Y(&YA;64](G1E>'0B/D-/54Y44ED+W1E>'0M<')O <&5R='D^
> M#0H@(" @(" @(" @(" @(" @(" @(" @(" +VQA8F5L/@T*(" @(" @(" @
> M(" @(" @(" @(" +V-E;&P^#0H@(" @(" @(" @(" @(" @/"]R;W<^#0H@
> M(" @(" @(" @(" +VAE861E<CX-"B @(" @(" @(" @(#QG<F]U<#X-"B @
> M(" @(" @(" @(" @(" <')O<&5R='D@;F%M93TB9W)O=7!.86UE(CYG<G Q
> M/"]P<F]P97)T>3X-"B @(" @(" @(" @(" @(" <')O<&5R='D@;F%M93TB
> M:6YT97)V86PB/FYO;F4+W!R;W!E<G1Y/@T*(" @(" @(" @(" @(" @(#QP
> M<F]P97)T>2!N86UE/2)S;W)T1&ER96-T:6]N(CYA<V,+W!R;W!E<G1Y/@T*
> M(" @(" @(" @(" @(" @(#QE>'!R97-S:6]N(&YA;64](FME>45X<'(B/G)O
> M=ULB0T]53E1262)=/"]E>'!R97-S:6]N/@T*(" @(" @(" @(" @(" @(#QH
> M96%D97(^#0H@(" @(" @(" @(" @(" @(" @(#QR;W<^#0H@(" @(" @(" @
> M(" @(" @(" @(" @(" 8V5L;#X-"B @(" @(" @(" @(" @(" @(" @(" @
> M(" @(" 9&%T83X-"B @(" @(" @(" @(" @(" @(" @(" @(" @(" @(" @
> M/&5X<')E<W-I;VX@;F%M93TB=F%L=65%>'!R(CYR;W=;(D-/54Y44EDB73PO
> M97AP<F5S<VEO;CX-"B @(" @(" @(" @(" @(" @(" @(" @(" @(" +V1A
> M=&$^#0H@(" @(" @(" @(" @(" @(" @(" @(" +V-E;&P^#0H@(" @(" @
> M(" @(" @(" @(" @(" @(" 8V5L;"^#0H@(" @(" @(" @(" @(" @(" @
> M(" @(" 8V5L;"^#0H@(" @(" @(" @(" @(" @(" @(#PO<F]W/@T*(" @
> M(" @(" @(" @(" @(#PO:&5A9&5R/@T*(" @(" @(" @(" @(" @(#QF;V]T
> M97(^#0H@(" @(" @(" @(" @(" @(" @(#QR;W<^#0H@(" @(" @(" @(" @
> M(" @(" @(" @(" 8V5L;"^#0H@(" @(" @(" @(" @(" @(" @(" @("
> M8V5L;"^#0H@(" @(" @(" @(" @(" @(" @(" @(" 8V5L;#X-"B @(" @
> M(" @(" @(" @(" @(" @(" @(" @(" 9&%T83X-"B @(" @(" @(" @(" @
> M(" @(" @(" @(" @(" @(" @/&5X<')E<W-I;VX@;F%M93TB=F%L=65%>'!R
> M(CYV87(@=&5S=" ]('1E<W1C;W5N=#L*=&5S=&-O=6YT(#T@,3L*=&5S=#L
> M+V5X<')E<W-I;VX^#0H@(" @(" @(" @(" @(" @(" @(" @(" @(" @/"]D
> M871A/@T*(" @(" @(" @(" @(" @(" @(" @(" @/"]C96QL/@T*(" @(" @
> M(" @(" @(" @(" @(" +W)O=SX-"B @(" @(" @(" @(" @(" +V9O;W1E
> M<CX-"B @(" @(" @(" @(#PO9W)O=7 ^#0H@(" @(" @(" @(" 9&5T86EL
> M/@T*(" @(" @(" @(" @(" @(#QR;W<^#0H@(" @(" @(" @(" @(" @(" @
> M(#QC96QL/@T*(" @(" @(" @(" @(" @(" @(" @(" @/&1A=&$^#0H@(" @
> M(" @(" @(" @(" @(" @(" @(" @(" @/&5X<')E<W-I;VX@;F%M93TB=F%L
> M=65%>'!R(CYR;W=;(D-54U1/34523E5-0D52(ET+V5X<')E<W-I;VX^#0H@
> M(" @(" @(" @(" @(" @(" @(" @(" +V1A=&$^#0H@(" @(" @(" @(" @
> M(" @(" @(#PO8V5L;#X-"B @(" @(" @(" @(" @(" @(" @/&-E;&P^#0H@
> M(" @(" @(" @(" @(" @(" @(" @(" 9&%T83X-"B @(" @(" @(" @(" @
> M(" @(" @(" @(" @(" 97AP<F5S<VEO;B!N86UE/2)V86QU945X<'(B/G)O
> M=ULB0U535$]-15).04U%(ET+V5X<')E<W-I;VX^#0H@(" @(" @(" @(" @
> M(" @(" @(" @(" +V1A=&$^#0H@(" @(" @(" @(" @(" @(" @(#PO8V5L
> M;#X-"B @(" @(" @(" @(" @(" @(" @/&-E;&P^#0H@(" @(" @(" @(" @
> M(" @(" @(" @(" 9&%T83X-"B @(" @(" @(" @(" @(" @(" @(" @(" @
> M(" 97AP<F5S<VEO;B!N86UE/2)V86QU945X<'(B/G)O=ULB0T]53E1262)=
> M/"]E>'!R97-S:6]N/@T*(" @(" @(" @(" @(" @(" @(" @(" @/"]D871A
> M/@T*(" @(" @(" @(" @(" @(" @(" +V-E;&P^#0H@(" @(" @(" @(" @
> M(" @/"]R;W<^#0H@(" @(" @(" @(" +V1E=&%I;#X-"B @(" @(" @(" @
> M(#QF;V]T97(^#0H@(" @(" @(" @(" @(" @/')O=SX-"B @(" @(" @(" @
> M(" @(" @(" @/&-E;&PO/@T*(" @(" @(" @(" @(" @(" @(" 8V5L;"^
> M#0H@(" @(" @(" @(" @(" @(" @(#QC96QL+SX-"B @(" @(" @(" @(" @
> M(" +W)O=SX-"B @(" @(" @(" @(#PO9F]O=&5R/@T*(" @(" @(" +W1A
>>8FQE/@T*(" @(#PO8F]D>3X-"CPO<F5P;W)T/@T*
> `
> end
Jason,
I can't use the pasted file (I don't recognize this wired format), could
you paste the xml text? (I use the BIRT 1.0.1)
Thanks.
Here is mine:
----------------------------------
<?xml version="1.0" encoding="UTF-8"?>
<!-- Written by Eclipse BIRT 1.0 -->
<report xmlns=" http://www.eclipse.org/birt/2005/design" version="2">
<property name="createdBy">Eclipse BIRT Designer Version 1.0.1 Build
&lt;20050729-0746></property>
<property name="units">in</property>
<method name="initialize"><![CDATA[var testcountT = 0;
var testcountG = 0;]]></method>
<data-sources>
<oda-data-source
extensionID="org.eclipse.birt.report.data.oda.flatfile" name="Data Source">
<property name="HOME">H:\trials\out\logs</property>
<property name="CHARSET">UTF-8</property>
<property name="INCLTYPELINE">YES</property>
</oda-data-source>
</data-sources>
<data-sets>
<oda-data-set
extensionID="org.eclipse.birt.report.data.oda.flatfile.dataSet " name="Data
Set2">
<property name="dataSource">Data Source</property>
<property name="queryText">select * from
cprt-20222222.csv</property>
</oda-data-set>
</data-sets>
<page-setup>
<simple-master-page name="Simple MasterPage">
<page-footer>
<text>
<property name="contentType">html</property>
<text-property name="content"><![CDATA[<value-of>new
Date()</value-of>]]></text-property>
</text>
</page-footer>
</simple-master-page>
</page-setup>
<body>
<table>
<property name="width">100%</property>
<property name="dataSet">Data Set2</property>
<method name="onRow"><![CDATA[testcountT = testcountT +
1;]]></method>
<column/>
<column/>
<column/>
<header>
<row>
<cell>
<label>
<text-property
name="text">transition</text-property>
</label>
</cell>
<cell>
<label>
<text-property name="text">user</text-property>
</label>
</cell>
<cell>
<label>
<text-property
name="text">totalTime</text-property>
</label>
</cell>
</row>
</header>
<group>
<property name="groupName">transitionsGroup</property>
<property name="interval">none</property>
<property name="sortDirection">asc</property>
<expression name="keyExpr">row["transition"]</expression>
<method name="onRow"><![CDATA[testcountG = testcountG +
1;]]></method>
<footer>
<row>
<cell>
<data>
<property name="fontWeight">bold</property>
<property
name="textUnderline">underline</property>
<expression
name="valueExpr">Total.count()</expression>
</data>
</cell>
<cell>
<data>
<property
name="textUnderline">underline</property>
<expression name="valueExpr">var testG =
testcountG;
testcountG = 0;
testG;</expression>
</data>
</cell>
<cell/>
</row>
</footer>
</group>
<detail>
<row>
<cell>
<data>
<expression
name="valueExpr">row["transition"]</expression>
</data>
</cell>
<cell>
<data>
<expression
name="valueExpr">row["user"]</expression>
</data>
</cell>
<cell>
<data>
<expression
name="valueExpr">row["totalTime"]</expression>
</data>
</cell>
</row>
</detail>
<footer>
<row>
<cell>
<data>
<property name="fontWeight">bold</property>
<expression
name="valueExpr">Total.count()</expression>
</data>
</cell>
<cell>
<data>
<property name="fontWeight">bold</property>
<expression name="valueExpr">var testT =
testcountT;
testcountT = 0;
testT;</expression>
</data>
</cell>
<cell/>
</row>
</footer>
</table>
</body>
</report>
----------------------------------
(If you can't see it clearly, you can maybe send yours directly to my
e-mail, and I'll send you mine)
Re: Scope of the variables (how to report values modified in the onRow method ) [message #76160 is a reply to message #76107] Wed, 21 September 2005 13:46 Go to previous messageGo to next message
Jason Weathersby is currently offline Jason WeathersbyFriend
Messages: 9167
Registered: July 2009
Senior Member

Gilles,
Here it is.

<?xml version="1.0" encoding="UTF-8"?>
<!-- Written by Eclipse BIRT 1.0 -->
<report xmlns=" http://www.eclipse.org/birt/2005/design" version="2">
<property name="createdBy">Eclipse BIRT Designer Version 1.0.1 Build
&lt;20050729-0746></property>
<property name="units">in</property>
<method name="initialize"><![CDATA[var testcount=1;]]></method>
<data-sources>
<oda-data-source
extensionID="org.eclipse.birt.report.data.oda.sampledb" name="Data Source"/>
</data-sources>
<data-sets>
<oda-data-set
extensionID="org.eclipse.birt.report.data.oda.jdbc.JdbcSelectDataSet "
name="Data Set">
<property name="dataSource">Data Source</property>
<property name="queryText">select *
from customers</property>
</oda-data-set>
</data-sets>
<page-setup>
<simple-master-page name="Simple MasterPage">
<page-footer>
<text>
<property name="contentType">html</property>
<text-property name="content"><![CDATA[<value-of>new
Date()</value-of>]]></text-property>
</text>
</page-footer>
</simple-master-page>
</page-setup>
<body>
<table>
<property name="width">100%</property>
<property name="dataSet">Data Set</property>
<method name="onRow"><![CDATA[testcount = testcount +
1;]]></method>
<column/>
<column/>
<column/>
<header>
<row>
<cell>
<label>
<text-property
name="text">CUSTOMERNUMBER</text-property>
</label>
</cell>
<cell>
<label>
<text-property
name="text">CUSTOMERNAME</text-property>
</label>
</cell>
<cell>
<label>
<text-property
name="text">COUNTRY</text-property>
</label>
</cell>
</row>
</header>
<group>
<property name="groupName">grp1</property>
<property name="interval">none</property>
<property name="sortDirection">asc</property>
<expression name="keyExpr">row["COUNTRY"]</expression>
<header>
<row>
<cell>
<data>
<expression
name="valueExpr">row["COUNTRY"]</expression>
</data>
</cell>
<cell/>
<cell/>
</row>
</header>
<footer>
<row>
<cell/>
<cell/>
<cell>
<data>
<expression name="valueExpr">var test =
testcount;
testcount = 1;
test;</expression>
</data>
</cell>
</row>
</footer>
</group>
<detail>
<row>
<cell>
<data>
<expression
name="valueExpr">row["CUSTOMERNUMBER"]</expression>
</data>
</cell>
<cell>
<data>
<expression
name="valueExpr">row["CUSTOMERNAME"]</expression>
</data>
</cell>
<cell>
<data>
<expression
name="valueExpr">row["COUNTRY"]</expression>
</data>
</cell>
</row>
</detail>
<footer>
<row>
<cell/>
<cell/>
<cell/>
</row>
</footer>
</table>
</body>
</report>

Jason Weathersby
BIRT PMC
"Gilles Vandaele" <gilles.vandaele@advalvas.be> wrote in message
news:e7f9f5874c870a8cbb5f507578224adf$1@www.eclipse.org...
> Jason Weathersby wrote:
>
>> Gilles,
>
>> Attached is my report design file.
>> Can you attach yours and let me look at it?
>> What version of BIRT are you using?
>
>> Jason Weathersby
>> BIRT PMC
>
>> "Gilles Vandaele" <gilles.vandaele@advalvas.be> wrote in message
>> news:e6652061397a8b795413340f6f0ecab5$1@www.eclipse.org...
>>>I just putted your code into my report: the 'test' variable shown in the
>>> group footer is at '1' !?!!...?
>>> (the "myVar="+myVar piece of code was just a concatenation to show
>>> 'myVar'
>>> in a string.)
>>>
>>> Let's try with a new blank report:
>>> I make a new Data source, a new Data set (from a flat file)
>>> I put a table on the report
>>> I add a group on the table
>>> In initialize():
>>> var testcountT = 0;
>>> var testcountG = 0;
>>>
>>> In the onRow() of my table:
>>> testcountT = testcountT + 1;
>>>
>>> In the onRow() of my TableGroup:
>>> testcountG = testcountG + 1;
>>>
>>> In the report hereunder, the '2,3,13,12' are the results of a data
>>> element
>>> with expression 'Total.count()' in the group footer;
>>> the '30' is the result of a data element with expression 'Total.count()'
>>> in the table footer;
>>> the '0,0,0,0'(?!?) are the results of a data element in the group footer
>>> with expression :
>>>
>>> var testG = testcountG;
>>> testcountG = 0;
>>> testG;
>>>
>>> and the '26'(?!?) is the result of a data element in the table footer
>>> with
>>> expression:
>>>
>>> var testT = testcountT;
>>> testcountT = 0;
>>> testT;
>>>
>>>
>>>
>>> You see here under the report:
>>>
>>>
>>> transition user totalTime
>>> AutoBOOffer_Broker DLHO773 985
>>> AutoBOOffer_Broker DJVR335 1234
>>> 2 0
>>> AutoBOOffer_Guarantees DLHO773 891
>>> AutoBOOffer_Guarantees DJVR335 719
>>> AutoBOOffer_Guarantees DEMO188 1609
>>> 3 0
>>> AutoBOOffer_Premium DMBE098 4172
>>> AutoBOOffer_Premium DADU237 5600
>>> AutoBOOffer_Premium DAPA773 4547
>>> AutoBOOffer_Premium DMOS844 3922
>>> AutoBOOffer_Premium DSAV613 7961
>>> AutoBOOffer_Premium DJME971 11359
>>> AutoBOOffer_Premium DJME971 3000
>>> AutoBOOffer_Premium DPGE475 9578
>>> AutoBOOffer_Premium DLHO773 5078
>>> AutoBOOffer_Premium DACL354 5203
>>> AutoBOOffer_Premium DJVR335 3860
>>> AutoBOOffer_Premium DCNI465 3047
>>> AutoBOOffer_Premium DEMO188 4250
>>> 13 0
>>> AutoBOOffer_Summary DMBE708 9031
>>> AutoBOOffer_Summary DMBE708 2391
>>> AutoBOOffer_Summary DJCA717 4422
>>> AutoBOOffer_Summary DJCA717 1890
>>> AutoBOOffer_Summary DMIJ601 7938
>>> AutoBOOffer_Summary DMBE098 4985
>>> AutoBOOffer_Summary DMOS844 8984
>>> AutoBOOffer_Summary DJME971 9500
>>> AutoBOOffer_Summary DPGE475 5031
>>> AutoBOOffer_Summary DLHO773 8829
>>> AutoBOOffer_Summary DJVR335 6297
>>> AutoBOOffer_Summary DCNI465 5734
>>> 12 0
>>> 30 26
>>>
>>>
>>> I don't understand the '0,0,0,0' and the '26'.
>>> When are the Table.onRow() and the TableGroup.onRow() called?
>>> Could you send me your rptdesign file?
>>> Thanks,
>>> Gilles
>>>
>>>
>>>
>
>
>> begin 666 grpfooter.rptdesign
>> M/#]X;6P@=F5R<VEO;CTB,2XP(B!E;F-O9&EN9STB551&+3@B/SX-"CPA+2T@
>> M5W)I='1E;B!B>2!%8VQI<'-E($))4E0@,2XP("TM/@T*/')E<&]R= "!X;6QN
>> M<STB(&AT=' Z+R]W=W<N96-L:7!S92YO<F<O8FER="R,# U+V1E<VEG;B(@
>> M=F5R<VEO;CTB,B(^#0H@(" @/'!R;W!E<G1Y(&YA;64](F-R96%T961">2(^
>> M16-L:7!S92!"25)4($1E<VEG;F5R(%9E<G-I;VX@,2XP+C$@0G5I;&0@)FQT
>> M.S(P,#4P-S(Y+3 W-#8^/"]P<F]P97)T>3X-"B @(" <')O<&5R='D@;F%M
>> M93TB=6YI=',B/FEN/"]P<F]P97)T>3X-"B @(" ;65T:&]D(&YA;64](FEN
>> M:71I86QI>F4B/CPA6T-$051!6W9A<B!T97-T8V]U;G0],3M=73X+VUE=&AO
>> M9#X-"B @(" 9&%T82US;W5R8V5S/@T*(" @(" @(" ;V1A+61A=&$M<V]U
>> M<F-E(&5X=&5N<VEO;DE$/2)O<F<N96-L:7!S92YB:7)T+G)E <&]R="YD871A
>> M+F]D82YS86UP;&5D8B(@;F%M93TB1&%T82!3;W5R8V4B+SX-"B @(" +V1A
>> M=&$M<V]U<F-E<SX-"B @(" 9&%T82US971S/@T*(" @(" @(" ;V1A+61A
>> M=&$M<V5T(&5X=&5N<VEO;DE$/2)O<F<N96-L:7!S92YB:7)T+G)E <&]R="YD
>> M871A+F]D82YJ9&)C+DID8F-396QE8W1$871A4V5T(B!N86UE/2)$871 A(%-E
>> M="(^#0H@(" @(" @(" @(" <')O<&5R='D@;F%M93TB9&%T85-O=7)C92(^
>> M1&%T82!3;W5R8V4+W!R;W!E<G1Y/@T*(" @(" @(" @(" @/'!R;W!E<G1Y
>> M(&YA;64](G%U97)Y5&5X="(^<V5L96-T("H*9G)O;2!C=7-T;VUE <G,+W!R
>> M;W!E<G1Y/@T*(" @(" @(" +V]D82UD871A+7-E=#X-"B @(" +V1A=&$M
>> M<V5T<SX-"B @(" <&%G92US971U<#X-"B @(" @(" @/'-I;7!L92UM87-T
>> M97(M<&%G92!N86UE/2)3:6UP;&4@36%S=&5R4&%G92(^#0H@(" @(" @(" @
>> M(" <&%G92UF;V]T97(^#0H@(" @(" @(" @(" @(" @/'1E>'0^#0H@(" @
>> M(" @(" @(" @(" @(" @(#QP<F]P97)T>2!N86UE/2)C;VYT96YT5'EP92(^
>> M:'1M;#PO<')O<&5R='D^#0H@(" @(" @(" @(" @(" @(" @(#QT97AT+7!R
>> M;W!E<G1Y(&YA;64](F-O;G1E;G0B/CPA6T-$051!6SQV86QU92UO9CYN97 <@
>> M1&%T92@I/"]V86QU92UO9CY=73X+W1E>'0M<')O<&5R='D^#0H@(" @(" @
>> M(" @(" @(" @/"]T97AT/@T*(" @(" @(" @(" @/"]P86=E+69O;W1E<CX-
>> M"B @(" @(" @/"]S:6UP;&4M;6%S=&5R+7!A9V4^#0H@(" @/"]P86=E+7-E
>> M='5P/@T*(" @(#QB;V1Y/@T*(" @(" @(" =&%B;&4^#0H@(" @(" @(" @
>> M(" <')O<&5R='D@;F%M93TB=VED=&@B/C$P,"4+W!R;W!E<G1Y/@T*( " @
>> M(" @(" @(" @/'!R;W!E<G1Y(&YA;64](F1A=&%3970B/D1A=&$@4V5T/"]P
>> M<F]P97)T>3X-"B @(" @(" @(" @(#QM971H;V0@;F%M93TB;VY2;W<B/CPA
>> M6T-$051!6W1E<W1C;W5N=" ]('1E<W1C;W5N=" K(#$[75T^/"]M971H;V0^
>> M#0H@(" @(" @(" @(" 8V]L=6UN+SX-"B @(" @(" @(" @(#QC;VQU;6XO
>> M/@T*(" @(" @(" @(" @/&-O;'5M;B^#0H@(" @(" @(" @(" :&5A9&5R
>> M/@T*(" @(" @(" @(" @(" @(#QR;W<^#0H@(" @(" @(" @(" @(" @(" @
>> M(#QC96QL/@T*(" @(" @(" @(" @(" @(" @(" @(" @/&QA8F5L/@T*(" @
>> M(" @(" @(" @(" @(" @(" @(" @(" @(#QT97AT+7!R;W!E<G1Y(&YA;64]
>> M(G1E>'0B/D-54U1/34523E5-0D52/"]T97AT+7!R;W!E<G1Y/@T*(" @(" @
>> M(" @(" @(" @(" @(" @(" @/"]L86)E;#X-"B @(" @(" @(" @(" @(" @
>> M(" @/"]C96QL/@T*(" @(" @(" @(" @(" @(" @(" 8V5L;#X-"B @(" @
>> M(" @(" @(" @(" @(" @(" @(#QL86)E;#X-"B @(" @(" @(" @(" @(" @
>> M(" @(" @(" @(" =&5X="UP<F]P97)T>2!N86UE/2)T97AT(CY#55-43TU%
>> M4DY!344+W1E>'0M<')O<&5R='D^#0H@(" @(" @(" @(" @(" @(" @(" @
>> M(" +VQA8F5L/@T*(" @(" @(" @(" @(" @(" @(" +V-E;&P^#0H@(" @
>> M(" @(" @(" @(" @(" @(#QC96QL/@T*(" @(" @(" @(" @(" @(" @(" @
>> M(" @/&QA8F5L/@T*(" @(" @(" @(" @(" @(" @(" @(" @(" @(#QT97AT
>> M+7!R;W!E<G1Y(&YA;64](G1E>'0B/D-/54Y44ED+W1E>'0M<')O <&5R='D^
>> M#0H@(" @(" @(" @(" @(" @(" @(" @(" +VQA8F5L/@T*(" @(" @(" @
>> M(" @(" @(" @(" +V-E;&P^#0H@(" @(" @(" @(" @(" @/"]R;W<^#0H@
>> M(" @(" @(" @(" +VAE861E<CX-"B @(" @(" @(" @(#QG<F]U<#X-"B @
>> M(" @(" @(" @(" @(" <')O<&5R='D@;F%M93TB9W)O=7!.86UE(CYG<G Q
>> M/"]P<F]P97)T>3X-"B @(" @(" @(" @(" @(" <')O<&5R='D@;F%M93TB
>> M:6YT97)V86PB/FYO;F4+W!R;W!E<G1Y/@T*(" @(" @(" @(" @(" @(#QP
>> M<F]P97)T>2!N86UE/2)S;W)T1&ER96-T:6]N(CYA<V,+W!R;W!E<G1Y/@T*
>> M(" @(" @(" @(" @(" @(#QE>'!R97-S:6]N(&YA;64](FME>45X<'(B/G)O
>> M=ULB0T]53E1262)=/"]E>'!R97-S:6]N/@T*(" @(" @(" @(" @(" @(#QH
>> M96%D97(^#0H@(" @(" @(" @(" @(" @(" @(#QR;W<^#0H@(" @(" @(" @
>> M(" @(" @(" @(" @(" 8V5L;#X-"B @(" @(" @(" @(" @(" @(" @(" @
>> M(" @(" 9&%T83X-"B @(" @(" @(" @(" @(" @(" @(" @(" @(" @(" @
>> M/&5X<')E<W-I;VX@;F%M93TB=F%L=65%>'!R(CYR;W=;(D-/54Y44EDB73PO
>> M97AP<F5S<VEO;CX-"B @(" @(" @(" @(" @(" @(" @(" @(" @(" +V1A
>> M=&$^#0H@(" @(" @(" @(" @(" @(" @(" @(" +V-E;&P^#0H@(" @(" @
>> M(" @(" @(" @(" @(" @(" 8V5L;"^#0H@(" @(" @(" @(" @(" @(" @
>> M(" @(" 8V5L;"^#0H@(" @(" @(" @(" @(" @(" @(#PO<F]W/@T*(" @
>> M(" @(" @(" @(" @(#PO:&5A9&5R/@T*(" @(" @(" @(" @(" @(#QF;V]T
>> M97(^#0H@(" @(" @(" @(" @(" @(" @(#QR;W<^#0H@(" @(" @(" @(" @
>> M(" @(" @(" @(" 8V5L;"^#0H@(" @(" @(" @(" @(" @(" @(" @(" M8V5L;"^#0H@("
>> @(" @(" @(" @(" @(" @(" @(" 8V5L;#X-"B @(" @
>> M(" @(" @(" @(" @(" @(" @(" @(" 9&%T83X-"B @(" @(" @(" @(" @
>> M(" @(" @(" @(" @(" @(" @/&5X<')E<W-I;VX@;F%M93TB=F%L=65%>'!R
>> M(CYV87(@=&5S=" ]('1E<W1C;W5N=#L*=&5S=&-O=6YT(#T@,3L*=&5S=#L
>> M+V5X<')E<W-I;VX^#0H@(" @(" @(" @(" @(" @(" @(" @(" @(" @/"]D
>> M871A/@T*(" @(" @(" @(" @(" @(" @(" @(" @/"]C96QL/@T*(" @(" @
>> M(" @(" @(" @(" @(" +W)O=SX-"B @(" @(" @(" @(" @(" +V9O;W1E
>> M<CX-"B @(" @(" @(" @(#PO9W)O=7 ^#0H@(" @(" @(" @(" 9&5T86EL
>> M/@T*(" @(" @(" @(" @(" @(#QR;W<^#0H@(" @(" @(" @(" @(" @(" @
>> M(#QC96QL/@T*(" @(" @(" @(" @(" @(" @(" @(" @/&1A=&$^#0H@(" @
>> M(" @(" @(" @(" @(" @(" @(" @(" @/&5X<')E<W-I;VX@;F%M93TB=F%L
>> M=65%>'!R(CYR;W=;(D-54U1/34523E5-0D52(ET+V5X<')E<W-I;VX^#0H@
>> M(" @(" @(" @(" @(" @(" @(" @(" +V1A=&$^#0H@(" @(" @(" @(" @
>> M(" @(" @(#PO8V5L;#X-"B @(" @(" @(" @(" @(" @(" @/&-E;&P^#0H@
>> M(" @(" @(" @(" @(" @(" @(" @(" 9&%T83X-"B @(" @(" @(" @(" @
>> M(" @(" @(" @(" @(" 97AP<F5S<VEO;B!N86UE/2)V86QU945X<'(B/G)O
>> M=ULB0U535$]-15).04U%(ET+V5X<')E<W-I;VX^#0H@(" @(" @(" @(" @
>> M(" @(" @(" @(" +V1A=&$^#0H@(" @(" @(" @(" @(" @(" @(#PO8V5L
>> M;#X-"B @(" @(" @(" @(" @(" @(" @/&-E;&P^#0H@(" @(" @(" @(" @
>> M(" @(" @(" @(" 9&%T83X-"B @(" @(" @(" @(" @(" @(" @(" @(" @
>> M(" 97AP<F5S<VEO;B!N86UE/2)V86QU945X<'(B/G)O=ULB0T]53E1262)=
>> M/"]E>'!R97-S:6]N/@T*(" @(" @(" @(" @(" @(" @(" @(" @/"]D871A
>> M/@T*(" @(" @(" @(" @(" @(" @(" +V-E;&P^#0H@(" @(" @(" @(" @
>> M(" @/"]R;W<^#0H@(" @(" @(" @(" +V1E=&%I;#X-"B @(" @(" @(" @
>> M(#QF;V]T97(^#0H@(" @(" @(" @(" @(" @/')O=SX-"B @(" @(" @(" @
>> M(" @(" @(" @/&-E;&PO/@T*(" @(" @(" @(" @(" @(" @(" 8V5L;"^
>> M#0H@(" @(" @(" @(" @(" @(" @(#QC96QL+SX-"B @(" @(" @(" @(" @
>> M(" +W)O=SX-"B @(" @(" @(" @(#PO9F]O=&5R/@T*(" @(" @(" +W1A
>>>8FQE/@T*(" @(#PO8F]D>3X-"CPO<F5P;W)T/@T*
>> `
>> end
> Jason,
> I can't use the pasted file (I don't recognize this wired format), could
> you paste the xml text? (I use the BIRT 1.0.1)
> Thanks.
> Here is mine:
> ----------------------------------
> <?xml version="1.0" encoding="UTF-8"?>
> <!-- Written by Eclipse BIRT 1.0 -->
> <report xmlns=" http://www.eclipse.org/birt/2005/design" version="2">
> <property name="createdBy">Eclipse BIRT Designer Version 1.0.1 Build
> &lt;20050729-0746></property>
> <property name="units">in</property>
> <method name="initialize"><![CDATA[var testcountT = 0;
> var testcountG = 0;]]></method>
> <data-sources>
> <oda-data-source
> extensionID="org.eclipse.birt.report.data.oda.flatfile" name="Data
> Source">
> <property name="HOME">H:\trials\out\logs</property>
> <property name="CHARSET">UTF-8</property>
> <property name="INCLTYPELINE">YES</property>
> </oda-data-source>
> </data-sources>
> <data-sets>
> <oda-data-set
> extensionID="org.eclipse.birt.report.data.oda.flatfile.dataSet " name="Data
> Set2">
> <property name="dataSource">Data Source</property>
> <property name="queryText">select * from
> cprt-20222222.csv</property>
> </oda-data-set>
> </data-sets>
> <page-setup>
> <simple-master-page name="Simple MasterPage">
> <page-footer>
> <text>
> <property name="contentType">html</property>
> <text-property name="content"><![CDATA[<value-of>new
> Date()</value-of>]]></text-property>
> </text>
> </page-footer>
> </simple-master-page>
> </page-setup>
> <body>
> <table>
> <property name="width">100%</property>
> <property name="dataSet">Data Set2</property>
> <method name="onRow"><![CDATA[testcountT = testcountT +
> 1;]]></method>
> <column/>
> <column/>
> <column/>
> <header>
> <row>
> <cell>
> <label>
> <text-property
> name="text">transition</text-property>
> </label>
> </cell>
> <cell>
> <label>
> <text-property name="text">user</text-property>
> </label>
> </cell>
> <cell>
> <label>
> <text-property
> name="text">totalTime</text-property>
> </label>
> </cell>
> </row>
> </header>
> <group>
> <property name="groupName">transitionsGroup</property>
> <property name="interval">none</property>
> <property name="sortDirection">asc</property>
> <expression name="keyExpr">row["transition"]</expression>
> <method name="onRow"><![CDATA[testcountG = testcountG +
> 1;]]></method>
> <footer>
> <row>
> <cell>
> <data>
> <property name="fontWeight">bold</property>
> <property
> name="textUnderline">underline</property>
> <expression
> name="valueExpr">Total.count()</expression>
> </data>
> </cell>
> <cell>
> <data>
> <property
> name="textUnderline">underline</property>
> <expression name="valueExpr">var testG =
> testcountG;
> testcountG = 0;
> testG;</expression>
> </data>
> </cell>
> <cell/>
> </row>
> </footer>
> </group>
> <detail>
> <row>
> <cell>
> <data>
> <expression
> name="valueExpr">row["transition"]</expression>
> </data>
> </cell>
> <cell>
> <data>
> <expression
> name="valueExpr">row["user"]</expression>
> </data>
> </cell>
> <cell>
> <data>
> <expression
> name="valueExpr">row["totalTime"]</expression>
> </data>
> </cell>
> </row>
> </detail>
> <footer>
> <row>
> <cell>
> <data>
> <property name="fontWeight">bold</property>
> <expression
> name="valueExpr">Total.count()</expression>
> </data>
> </cell>
> <cell>
> <data>
> <property name="fontWeight">bold</property>
> <expression name="valueExpr">var testT =
> testcountT;
> testcountT = 0;
> testT;</expression>
> </data>
> </cell>
> <cell/>
> </row>
> </footer>
> </table>
> </body>
> </report>
> ----------------------------------
> (If you can't see it clearly, you can maybe send yours directly to my
> e-mail, and I'll send you mine)
>
Re: Scope of the variables (how to report values modified in the onRow method ) [message #76387 is a reply to message #76160] Thu, 22 September 2005 08:18 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: gilles.vandaele.advalvas.be

Ok it works fine if you use the Table.onRow().
You didn't use the Group.onRow(). Why? What's the difference between the
Table.onRow() and the Group.onRow(). It seems that the Group.onRow() is
never called. (I've installed the 2.0M1, and it's the same behaviour) I'll
try to put my code (I do a bit more than a dummy count) in the
Table.onRow(). Isn't it odd that while incrementing the counter on each
onRow(), you need to initialize it to 1 (and not 0) to get the count? How
does it work?
Thanks
Gilles
Re: Scope of the variables (how to report values modified in the onRow method ) [message #76401 is a reply to message #76160] Thu, 22 September 2005 12:11 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: gilles.vandaele.advalvas.be

in addition to the previous (I'm still struggling to script a kind of
statistic on grouped rows):
Ok, we made a count on the groups, let's try something harder ;-) ,a
total (on the groups).
If I modify your piece of code <code>testcount = testcount + 1;</code> to
<code>testcount = testcount + row["CREDITLIMIT"];</code> in order to shown
the total of the credit limits of the grouped rows, I get an error:
------------------------------------
There are errors on the report page:
- There are error(s) in Table:null
Error0 : Failed to evaluate testcount = testcount +
row["CREDITLIMIT"];(94times)detail: Failed to evaluate testcount =
testcount + row["CREDITLIMIT"];ReferenceError: "row" is not defined. (#1)
------------------------------------
does it mean that the dataSet is not available into the table methods?
(actually the designer's row is embeded into the group)
The error doesn't happend if I put the code into the onRow method of the
tableGroup, but in this case the code isn't called as seen previously.

Tx
Gilles
Re: Scope of the variables (how to report values modified in the onRow method ) [message #76415 is a reply to message #76401] Thu, 22 September 2005 13:59 Go to previous messageGo to next message
Jason Weathersby is currently offline Jason WeathersbyFriend
Messages: 9167
Registered: July 2009
Senior Member

Gilles,
I changed the line of code in
table's onRow method to
testcount = testcount + row["CREDITLIMIT"];
And this worked fine for me.
I dont have a group onRow method. The designer doesnt allow me to put code
on the Group.
I am using 1.0.1.

Jason Weathersby
BIRT PMC

"Gilles Vandaele" <gilles.vandaele@advalvas.be> wrote in message
news:012139ad73fe2afcb156816d666b728f$1@www.eclipse.org...
> in addition to the previous (I'm still struggling to script a kind of
> statistic on grouped rows):
> Ok, we made a count on the groups, let's try something harder ;-) ,a
> total (on the groups).
> If I modify your piece of code <code>testcount = testcount + 1;</code> to
> <code>testcount = testcount + row["CREDITLIMIT"];</code> in order to shown
> the total of the credit limits of the grouped rows, I get an error:
> ------------------------------------
> There are errors on the report page: - There are error(s) in Table:null
> Error0 : Failed to evaluate testcount = testcount +
> row["CREDITLIMIT"];(94times)detail: Failed to evaluate testcount =
> testcount + row["CREDITLIMIT"];ReferenceError: "row" is not defined. (#1)
> ------------------------------------
> does it mean that the dataSet is not available into the table methods?
> (actually the designer's row is embeded into the group)
> The error doesn't happend if I put the code into the onRow method of the
> tableGroup, but in this case the code isn't called as seen previously.
>
> Tx
> Gilles
>
>
Re: Scope of the variables (how to report values modified in the onRow method ) [message #76704 is a reply to message #76415] Fri, 23 September 2005 10:38 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: gilles.vandaele.advalvas.be

If I come back to 1.0.1, it seems to work,... but look at the total of
each groups...
eg. for the Canada
---------------------------------
202 Canadian Gift Exchange Network Canada 90300
233 Québec Home Shopping Network Canada 48700
260 Royal Canadian Collectables, Ltd. Canada 89600
138301

-----------------------------------
138301=48700+89600 (I initialize and reset testCount to 0)
Why does it forget the first row? Is it the same on yours?


So it doesn't work (yet) in 2.0M1.
And in both version I do have access to the onRow() when a TableGroup is
selected in the outline panel, but this code is never called !?

Gilles
Re: Scope of the variables (how to report values modified in the onRow method ) [message #76814 is a reply to message #76704] Fri, 23 September 2005 14:49 Go to previous message
Jason Weathersby is currently offline Jason WeathersbyFriend
Messages: 9167
Registered: July 2009
Senior Member

Gilles,

I believe this is a bug, reported in 110118, but a work around is
to put some code on the control that will be in the group header
For example, I have a data control that displays my group name and
I add code to it (onCreate) that does the increment for the first row.
testcount = testcount + row["CREDITLIMIT"];
This makes it work, but I dont like it. I believe this is a bug.

Jason Weathersby
BIRT PMC

"Gilles Vandaele" <gilles.vandaele@advalvas.be> wrote in message
news:083ba1769e848ef159c8e05604663138$1@www.eclipse.org...
> If I come back to 1.0.1, it seems to work,... but look at the total of
> each groups...
> eg. for the Canada --------------------------------- 202 Canadian Gift
> Exchange Network Canada 90300 233 Qu
Previous Topic:Memory leak in ReportEngine.destroy?
Next Topic:EJB as datasource
Goto Forum:
  


Current Time: Thu Apr 18 16:01:38 GMT 2024

Powered by FUDForum. Page generated in 0.03168 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top