General information
Category:
Reports & Report designer
Thanks Tamar, not sure why I didn't think of that technique. Now I just have to figure out why the object rotation isn't working...
>>I am designing a report, and need to display cross-tabbed data. The data has already been pivoted. My task is to display this data that has an unknown number of columns at design time.
>>
>>Is there a solution for this problem?
>>
>>One thought I had was to build up HTML from the pivoted data, but I'm not sure if VFP report designer can display html.
>
>Nancy Jacobsen published a solution to this problem in FoxTalk a long, long time ago (1990 or 1991, I think).
>
>The basic idea is that you set up your report with as many columns as fit comfortably. In the calling program, you use code like:
>
>nColumns = # of data columns in the report
>nDataFields = FCOUNT() - 1 && first field is label
>nPages = INT(nDataFields/nColumn) + 1
>
>FOR nPage = 1 to nPages
> REPORT FORM (YourReport)
>ENDFOR
>
>In the report, you use a complicated expression involving the FIELD() function and nPages to put the fields (and the headings) in place. It varies from column to column, but it's along these lines (this one is for the first data column):
>
>IIF(TYPE(FIELD((nPage-1)*nColumns + 1)) <> "U", ;
>FIELD((nPage-1)*nColumns + 1),"")
>
>IOW, the first time through the loop, you report on data columns 1 through nColumns. The second time, it's nColumns + 2 up to 2*nColumns, etc.
>
>The expression for the data checks whether there's a field to report on in this column and if so, shows the data.
>
>Hope this helps.
>
>Tamar
Previous
Next
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only