Recent

Author Topic: LazReport grouping  (Read 4546 times)

scons

  • Full Member
  • ***
  • Posts: 141
LazReport grouping
« on: October 03, 2017, 11:13:49 am »
Hi all,

Next episode in the learning curve: creating reports.

I have a small in memory dataset (sdfdataset, all it is needed for is the creating of reports, no data will be removed or added).

When trying to create reports I do not get the expected result.

Expected result would be something like this:

Code: Text  [Select][+][-]
  1.  
  2. load_1 (LOAD)
  3.  
  4.     100 (NR)   3500*190*200 (ASSDIM) 148 (ASSWEIGHT)
  5.     101        3000*190*200          127
  6.     -----------------------------------------------------
  7.                2x     101   subtotal 254
  8.     200        4000*190*200          169
  9.     201        3200*190*200          135
  10.     300        4000*171*180          142
  11.    ------------------------------------------------------
  12.                2x    300    subtotal 284
  13.     301        3500*171*180          124
  14.    ======================================================
  15.                              TOTAL  1114
  16.  
  17. load_2
  18.  
  19.     100        3500*190*200          148
  20.     ....
  21.  
  22. load_3
  23.  
  24. etc. ...
  25.  
  26.  

But the first grouping (of loads) already goes wrong, can't seem to find the right way.
Would someone be so kind to tell me what I am doing wrong with the grouping selection ?
Project attached.

Thanks
Windows 10-64bit Lazarus 2.0.12 + FPC 3.2.0

Graeme

  • Hero Member
  • *****
  • Posts: 1428
    • Graeme on the web
Re: LazReport grouping
« Reply #1 on: October 12, 2017, 05:34:51 pm »
Expected result would be something like this:
Is it "something like that" or "exactly like that"?

Also I don't fully understand your report output (the example you showed in your post). What is the "2x   101 ... subtotal" lines and is the 200-300 subtotal line correct?

--
fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal
http://fpgui.sourceforge.net/

scons

  • Full Member
  • ***
  • Posts: 141
Re: LazReport grouping
« Reply #2 on: October 13, 2017, 11:40:44 am »
Hi

The "idea" was to group by load, then a subtotal by load and a project total.
Subtotal and projecttotal should be a sum of the table 'ASSWEIGHT', subtotal -> per load a total of 'ASSWEIGHT' and projecttotal -> total of all values 'ASSWEIGHT'.

Subtotal calculates oke and projecttotal was not the issue, this calculates easily.
The problem I have is the grouping with these 2 datasets.

Dataset 2 contains the different possible loads.
Dataset 3 contains the data.

Grouping should be done by dataset 2 (by LOAD) with values showed of dataset 3.

------------

Second :

As you can have more then 1 value of column NR which is the same in 1 load, I was thinking of some sort of "inner calculation" to get the amount of identical data in 1 load.
(Identical data in column NR)

For example:

load_1 contains 2x NR 101

Code: Text  [Select][+][-]
  1. IDX     ID      NR      PROF    ASSDIM  ASSWEIGHT       LOAD
Code: Text  [Select][+][-]
  1. 5       100020  101     HEA200  3000*190*200    127     load_1
  2. 6       100017  101     HEA200  3000*190*200    127     load_1

load_1 contains 2x NR 300

Code: Text  [Select][+][-]
  1. 17      100041  300     HEA180  4000*171*180    142     load_1
  2. 20      100042  300     HEA180  4000*171*180    142     load_1

So I also would like to have a total of how many times the value in column NR occurs.

In my first post, that is the '2x     101   subtotal 254' and '2x    300    subtotal 284' line.
Although the actual subtotal per NR is not really neccesary, the amount of entries of NR in a load would be really handy.

(Let's assume NR 101 has 23 entries in Load_1, it would be handy it is on the report how many times 101 is in load_1 without having to count it yourself. Read, 23 times line with all data of NR 101 printed below each other.)
Code: Text  [Select][+][-]
  1. load_1
  2.    101
  3.    101
  4.    101
  5.    101
  6.    101
  7.    101
  8.    101
  9.    101
  10.    101
  11.    101
  12.    101
  13.    101
  14.    101
  15.    101
  16.    101
  17.    101
  18.    101
  19.    101
  20.    101
  21.    101
  22.    101
  23.    101
  24.    101

Would refer to
Code: Text  [Select][+][-]
  1. load_1
  2. 23x  101


If you show report 2 of my tryout, you will see that on the first page the list has an entry:

Code: Text  [Select][+][-]
  1. load_1
  2.    101
  3.    101

Maybe an extra column which states:
Code: Text  [Select][+][-]
  1. load_1
  2. 2x   101
will be easier, I don't know an I don't know if this is possible.

I hope this is more clear to you ?

Windows 10-64bit Lazarus 2.0.12 + FPC 3.2.0

 

TinyPortal © 2005-2018