Home General
New Blog Posts: Merging Reports - Part 1 and Part 2

Crosstab config problem

edited November 2003 in General
hi,
first, let me explain what i need to print:

foreach customer i have a 200+ column report to print (they need to be
grouped together also but that is irrelevant for the problem right now)
now the values for these columns are preprossed so it is just a matter of
getting them on paper

i started out to set up a Master Detail table so i could use the crosstab
component
so the master contains the row info - the customer
the detail contains the column info - 1 value (so no need to sum or
anything)

problems:
1) caption, every column needs its own caption, i could use a field in the
detail table for that but it would be better if i could set up a description
table for it, is this possible (getting the column description out of
another table, or with some kind of event or something)
2) every column has a different format to print, sometimes its need to be
print like an integer, sometimes as money, is there a way to dynamically
alter the format in wich the value needs to be printed
3) i have only 1 value for each column for each customer, but i need a row
grand total for the sum, but also for the Count and Average of that one
value, now i tried to solve that by adding the same value as a new value in
the crosstab so get my Count and Average, the problem is that i do not want
the row values of Count and Average to be printed, it seems that i cannot
alter the visible check on a row value...

let it be clear that i'm in fact using the crosstab to get my report printed
over multiple pages, i could do it 'by hand' but then i suffer from
flexibility when new columns have to be added to the report

or is there a way to design a 200+ column report like one really wide report
and that RB will cut it into pieces to be print correctly (but then i also
needs to be able to reprint header and row info on each page

any comments on how to solve this the best way more then welcome!
tia!
Marc

Comments

  • edited November 2003
    Hi Marc,

    1. Check out the crosstab demo number 127 (ct127.pas) located in the
    \RBuilder\Demos\CrossTabs\... directory. This example shows how to
    customize the captions for each column header. It also gives a good example
    about how to change the format of each column/cell if you need.

    2. As an alternative to using a CrossTab component, check out the following
    example by clicking on the link below. This shows how to create a
    spreadsheet style report that extends further than one page wide. This may
    be a better option for what you are trying to accomplish.

    http://www.digital-metaphors.com/tips/SpreadSheetStyleReport.zip

    --
    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited November 2003
    Hi Marc,

    Sorry, it must have been saved with the full file path. Select the View |
    Project Manager from your Delphi Main menu, right click over the project
    name and select to View Source from the popup menu. Then delete the path
    from the line in the 'uses' clause leaving only the following text:

    SpreadSheetStyle in 'SpreadSheetStyle.pas';

    This should solve the problem for you. You can also try downloading it
    again from the link below as I fixed the problem as well.

    http://www.digital-metaphors.com/tips/SpreadSheetStyle.zip

    --
    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited November 2003
    Nico,
    thx for the fast reply!
    i guess problem 1 is solved

    now i've looked a the problem a bit further and came to the conclusion that
    the number of columns aren't fixed, so it may well be that i now need to
    print 10 columns and tomorrow 20 based on some rows defined in another table
    so i'm looking into the crosstab once more wich leaves point 3) in the open
    any comments on that? can i somehow in code disable the printing of the
    Average and Count row for every detail row?

    thx!
    Marc


  • edited November 2003
    Nico,
    the example provided gives me an error saying that it can't open the file
    SpreadSheetStyle in '\\DM266\Tech
    Support\Examples\SpreadSheetStyleReport\SpreadSheetStyle.pas'
    can i download that one somewhere?
    thx
    marc

  • edited November 2003
    Sorry,
    ignore that one,
    after posting i was clever enough to alter the path name
    cu
    marc

  • edited November 2003
    Nico,
    also is it possible for the caption of the columns to be multi-line
    cause i need rather descriptive captions and like it is now i have way to
    much white space between column values
    thx,
    marc

  • edited November 2003
    Nico,
    i tried to add a #13 or #13+#10 in the ongetcaption events, this alters the
    caption but does not have the effect
    of multilining it
    is this somehow possible?
    thx
    marc

  • edited November 2003
    Hi Marc,

    Sorry, the crosstab engine calculates the height of each cell before these
    events are called. Increasing the height of a crosstab cell is not
    possible.

    --
    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited November 2003
    Damn,
    so i'm stuck here
    so i have to figure out how to crosstab in spreadsheet style
    i guess simple things do not exist in life
    cu
    marc

  • edited November 2003
    Nico,
    not even through columndef or rowdef?
    what about manipulating the matrix?
    where do i have to look to alter the renderen code myself?
    if i could just get the column caption to clip and print accordingly it
    would provide the solutions i'm looking for
    tia,
    marc

  • edited November 2003
    Marc,

    I have tried everything to get this to work but have been unsuccessful. The
    problem is that the CrossTab component contains its own logic to traverse a
    dataset, which prevents the altering of the matrix after all cells have been
    calculated. I had some success using the CrossTab.Matrix.InsertRows method
    but then this new row needs a data field to show up, which does not give you
    the effect you are looking for. Your options would be to create the
    spreadsheet manually using the same method as the SpreadSheetStyle example I
    sent in an earlier post, or using our current code for the CrossTab
    Renderer, create your own that allows you to alter the height of a row, or
    add new lines. You will find the code in the ppCTRend.pas.

    --
    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited November 2003
    Nico,
    i must say that i've looked at every delphi report generator by now and all
    have the same problem
    i looked into the renderer code but i do not think it is something i can
    alter over night
    so i'm trying to think of some other methods
    the biggest problem is that the number of columns is undetermind before
    runtime
    so i really should be able to put the columns in code into the report
    this surely can be done but since i've never done it it will be a long and
    tedious task i guess
    thx anyway
    marc

This discussion has been closed.