Cross tab reports

Hi

I have tried making a simple cross tab report by adding master data and cross data bands. The guide then says add an object and thats that! Hmmm What am i meant to do with the object? I have tried setting it to field in my second table, but that causes errors. What should i be doing? The demo's dont seem to have anything in the 'cell' and i cant work out what is going on in the frdemo.

I have two tables, linked by a field called adminNo, the second table has field called 'result'. It is a one-to-many relationship. So there will be several 'result' values for each adminNo.

I am trying to use the free reports, if the cross tab report I am trying to create can only be done using fast report I will buy that package.

thanks for any help
Pete

Comments

  • gordkgordk St.Catherines On. Canada.
    edited 12:05AM
    hi pete
    i dont remember what report demos are available
    in free report
    but see if you have the printable2 demo.
    when using with a cross data band in conjunction with a master databand
    you need to connect mdband to table/query through frdbdataset
    and the cross databand to an fruserdataset 1 for each horizontal band it crosses.
    mhband.mdband
    the memo containing [Cell] derives its values from the ongetvalue event handler
    of the report component, as does the memo containing [header]
    the range of the fruserdatasets is set to recount and the count value is set to fieldcount of the table.
    that is the basics there are some other requirements shown in the demo
    ways to get field sizing etc.
    Once you understand this demo crosstabs using table/queries is a snap.
    ;)

  • edited 12:05AM
    Hi

    I saw that the demo was somehow building the report at runtime with code. Is that absolutly necessary? I have not got a clue what the code is doing with the fruserdataset's. Is there a tutorial I could follow somewhere that explained what I was doing and why? The documentation seems sparse, is it better with the fast report package? Am I missing something?

    Thanks
    Pete
  • edited 12:05AM
    Hi

    Further to my last post, I have looked and steped through the demo. Am i right in thinking that the fruserdataset is basically being used as a 'counter' to count from 0 to the number of fields in the table/query? Is this because the rangeEnd property is set to reCount?

    That is what appears to be happening in the demo. However, in the example I am working on although rangeEndCount is being set to 2, the value of fruserdataset.recNo doesnt appear to change in the ongetvalue event handler.

    Am I on the right track? Any ideas why my recNo is not being incremented?

    Thanks
    Pete

  • gordkgordk St.Catherines On. Canada.
    edited 12:05AM
    Hi Pete
    do you have the demo i mentioned.
    if the answer is yes
    try this with the demo
    select the table object open the fields editor for the table delete the fields.
    now set the table component's databasename to your dbname and the tablename to your table name. open the fields editor for the table again and add all the fields of your table.
    run the demo to see the output.
    what you are probably missing is setting the datasource properties of the cross databand. you need to set the fruserdataset for each of the bands shown in the left hand pane.
    Also look at the events that are used in the reportcomponent, pay close attention.
    the onbefore print event is not written by dblclicking the event and adding code.
    it is just has an onenterrectangle procedure assigned to it.
    ;)
  • edited 12:05AM
    Hi

    Thanks for this help. I dont think I have the printable2 demo, I have a prntable but it doesnt have an onbefore print event.

    You were write about me not having assigned the datasource properties of the cross databand to be the fruserdataset. My report now shows values! However, it is only showing one record's results rather than all the results ;)

    Just to explain further; I have two tables, linked by a field called adminNo, the second table has field called 'result'. It is a one-to-many relationship. So there will be two 'result' values for each adminNo. So my first table might have data:
    adminNo fname sname
    001 fred smith

    And my second table:
    adminNo result
    001 78
    001 94

    and I want my report to be:
    adminNo fname sname result1 result 2
    001 fred smith 78 94

    but what i seem to be getting is:
    adminNo fname sname result1
    001 fred smith 78

    Is it possible to do what I want?

    Thanks again for your help

    Pete



  • edited 12:05AM
    further to my last post! I have finally found frdemo and tracked down a doc4.frf that appears to be a cross tab report. I was saving my report in the dfm, not sure what the advantage of saving the report as a frf and then loading it is?

    Anyway I notice that that has a cross header, and an object with row 1[Master position] but i can find no reference to this in either the manual (fr_eng.doc: report generator fastReport v2.3), the help or the units! ;) What am i meant to do with it?

    Sorry for so many questions.....

    Pete

  • gordkgordk St.Catherines On. Canada.
    edited 12:05AM
    Hi since you don't have the demo i mentioned ,my fault, it doesn't come with free
    report, i'll try to work with you on the one you do.
    The difference between storing a report in dfm and storing ias an frf.
    if you store in dfm, you need 1 report component for each report, and if you make design changes you must send a new exe,file to your end user.
    if you store as a .frf, you can make design changes and never have to recompile the app., just send new frf and you wont have a huge .exe file.

    Looking at the memo that contains

    row 1[Master position]
    row 1 is just text and the altkey# used to get superscript 1.
    master position is a variable in the datadictionary.
    in design window filemenu-datadictionary to see the variables used in the report and what they are related to. Notice that the "Cell" vaiable has an expression
    attached
    The masterdata data band and cross data bands are set to virtual data sets of n records to suit what we want. if you change the count then the expression in cell variable and others, must be changed to suit.
    This is a totally self-contained report and uses no outside code.

    When working with data things change considerably
    the masterdata row connects to a frdbdataset and the programmer becomes responsible for retreiving values and positioning of the cross data bands datasource
    by passing out info to delphi, row = [Line#]. column := column =[Col#], using either report component events or on userfunction event handlers and userfunctions in the obp event of a report band.

    Note it is probably easier to supply data from a joined query to retieve
    one dataset with fields ordered by grouping conditions. than trying to control 2 or 3 datasets.
    In Full version there is a cross tab object which makes this process much easier to deal with.
    hope this Helps.
    if you are still having problems
    contact me at
    gknight13atcogecodotca replace obvious
    ;)





  • edited 12:05AM
    Thank you! I think that is my cross tab problem sorted for a while...

    ;)
    Pete

Leave a Comment

Rich Text Editor. To edit a paragraph's style, hit tab to get to the paragraph menu. From there you will be able to pick one style. Nothing defaults to paragraph. An inline formatting menu will show up when you select text. Hit tab to get into that menu. Some elements, such as rich link embeds, images, loading indicators, and error messages may get inserted into the editor. You may navigate to these using the arrow keys inside of the editor and delete them with the delete or backspace key.