Information générale
Catégorie:
Gestionnaire de rapports & Rapports
Versions des environnements
>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
Précédent
Suivant
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement