_Genxtab Reporting (My mistake - Not Genxref)

This is the corrected post... I have mistaken _Genxtab with _Genxref - Sorry.

Hi all;

I am planning some repoting on cursors generated with _genxtab.
Obviously the generated cursor is dynamic and the number of fields is unknown during design time.
I was wondering if there are any ideas out there to handle this. Right now all I can think of is to generate a single report where in the detail band I put a single field with "thisform.makeline()" which is a function generating a single line out of the multiple fields. There are some problems with that including problems with having report totals.

I have a feeling that VFP9 offers better solutions to this problem, and I would love to know the secret if any.

As always, thank you all for your suggestions.



Answer this question

_Genxtab Reporting (My mistake - Not Genxref)

  • daniel mark

    The best solution I've ever found for this problem was published in FoxTalk in about 1992. The article by Nancy Jacobsen (incidentally, one of the original MVPs for FoxPro) takes advantage of the FIELD() function. Basically, you set up the report with as many columns of data as fit horizontally (presumably after one or two columns of other stuff). Instead of referring to columns by their names, you use an expression like:

    EVAL(FIELD(nColumnsPerPage * (nPage-1) + nColumn))

    You actually have to use IIF() to check whether there is such a column, but that's the basic idea. nPage is a page counter. You divide the number of data columns (which is the field count less the other fields) by the number of columns you can fit on the page to see how many horizontal pages you need and run the report in a loop.

    Hope this makes sense.

    Tamar

  • yjtsai

    One of the solutions I've used since fox2x is to use an array (2 arrays really, one for the header, one for the data). I place fields max with expressions like (for second col):

    aHeaders[2]

    aData[recno(),2]

    Thus I do not need to know how many columns would there be really (empty members do not print anything - format Z for numeric ones or directly transform as you wish while preparing array).

    One another solution is to use HTML report instead.


  • graced

    Thank you both.
    I did think of doing it this way as well, but I thought maybe with the new VFP9 listener I can manipulate the positioning and content of fields in a report.

    This should do it though. Thanks again.

  • _Genxtab Reporting (My mistake - Not Genxref)