Recent

Author Topic: [SOLVED] LazReport : How to make a sub-total  (Read 10893 times)

tintinux

  • Sr. Member
  • ****
  • Posts: 348
    • Gestinux
[SOLVED] LazReport : How to make a sub-total
« on: July 19, 2010, 10:43:26 am »
Hi,

I'm currently using Lazarus 0.28.2, french localized version.

In a lrf file, I have 3 bands :

  • Group header
  • Master Data
  • Group footer

Data is sorted and there is a breaking condition. The layout is correct and I see the group footers in the right places.

The issue is to print the subtotal.

In the footer band I have tried :

Code: [Select]
[SUM([Query.Amount]); 'DonnéesPrincipale1']
I discovered that I must use a semi-column instead of a comma otherwise the program (and lazarus) hangs...

The band name used is exactly as displayed in the bottom, In french with accentuated characters.

The result is always the total of the report, not of the previous band. I tried also with double quotes around the band name and the result is blank.

What am I doing wrong ?

I have attched the lrf, renamed as txt.

Thanks for some help !

Tintinux







« Last Edit: July 21, 2010, 06:59:54 pm by tintinux »
Initiator of gestinux, open-source, multi-database and multilingual accounting and billing software made with LAZARUS.

You can help to develop, to make and improve translations, and to provide examples of legal charts and reports from more countries.

stonefull

  • Jr. Member
  • **
  • Posts: 54
Re: LazReport : How to make a sub-total
« Reply #1 on: July 19, 2010, 05:05:34 pm »
To sum fields use only:

Code: [Select]
[SUM([Query.Amount])]

tintinux

  • Sr. Member
  • ****
  • Posts: 348
    • Gestinux
Re: LazReport : How to make a sub-total
« Reply #2 on: July 19, 2010, 09:54:27 pm »
Hi,

No, this do not work.
It prints on each footer the total of the whole report, like with a band name.

Regards
Tintinux
Initiator of gestinux, open-source, multi-database and multilingual accounting and billing software made with LAZARUS.

You can help to develop, to make and improve translations, and to provide examples of legal charts and reports from more countries.

jesusr

  • Sr. Member
  • ****
  • Posts: 496
Re: LazReport : How to make a sub-total
« Reply #3 on: July 20, 2010, 12:36:21 am »
the band name should be a parameter to Sum() function, so:

Code: [Select]
[SUM([Query.Amount], DonnéesPrincipale1)]
also see

http://forum.lazarus.freepascal.org/index.php/topic,6072.msg28328.html#msg28328

tintinux

  • Sr. Member
  • ****
  • Posts: 348
    • Gestinux
Re: LazReport : How to make a sub-total
« Reply #4 on: July 20, 2010, 07:32:38 am »
Hi Jesus and thanks for you answer,

Yes, I understood that the band name should be a parameter of SUM.
But as you can see in the beginning of the post, I was not sucessful...

With your proposed syntax (and a comma), an exception is raised : "EConvertErrror" with message ",DonnéesPrincipale1" is not an integer". I have no more hang this morning.

That's why I have I have tried the semi colon instead with a slight better result... but I get always the total, not the subtotal. 

So, I'm still stuck...  Isn't it an issue with localization ? Should I try to change the band name in the lrf ?

Regards
Tintinux
Initiator of gestinux, open-source, multi-database and multilingual accounting and billing software made with LAZARUS.

You can help to develop, to make and improve translations, and to provide examples of legal charts and reports from more countries.

jesusr

  • Sr. Member
  • ****
  • Posts: 496
Re: LazReport : How to make a sub-total
« Reply #5 on: July 20, 2010, 08:24:54 am »
In your example, the semicolon is at the right of the ")" bracket, this is wrong, it should be a comma and it should be within the SUM "()" brackets. In the supplied information there is no evidence that it is a typo (the lrf file also has it).

I tried here using band name with accents and works fine, if you want to try check the lazreport/samples/editor example, open report albumsbycountry.lrf and press the "edit report" button, in designer, change the data band name from MasterData1 to DonnéesPrincipale1 using the object inspector, then double click memo6 on group footer and do the same change MasterData1 to DonnéesPrincipale1 in the two places there, save and close.
using the combobox filter in main form, select BYCOUNTRY filter and press the "preview report" button, it should work.

tintinux

  • Sr. Member
  • ****
  • Posts: 348
    • Gestinux
Re: LazReport : How to make a sub-total
« Reply #6 on: July 20, 2010, 06:38:12 pm »
Many thanks Jesus

Yes, I made a mistake with parenthesis and brackets and now it works as expected.
I apologize for this beginner error !

However, suppose that I share my developments and that someone, not speaking french at all, wants to work on my report created with a french localized Lazarus : he might have some difficulties to understand...

I suggest to create new bands with an untranslated name (in english, like other Lazarus components : "Edit1" not "Champ1"...). Maybe some people would like to change the name easier than by editing the text file. Of course all this is not very important, but might be improved in some next release.

Regards,

Tintinux
Initiator of gestinux, open-source, multi-database and multilingual accounting and billing software made with LAZARUS.

You can help to develop, to make and improve translations, and to provide examples of legal charts and reports from more countries.

 

TinyPortal © 2005-2018