[WD20] Report with No Source - Add Table Line

Startbeitrag von Curtis am 17.06.2016 21:39

I have a table style report with no data source. I pass a Data Source variable to the report, but I do extra calculations to it and my final report data ends up in an associative array of structure.

Is there a way to add a table line to the report table without using the built in data sources(HReadFirst,HReadNext)? The for each loop I have now only writes to the first row.

FOR EACH stAnalyticInfo,sItem of aaItemAnalytics
ITEM_COL_A = sItem
ITEM_COL_B = stAnalyticInfo.xTotal/stAnalyticInfo.nCount
ITEM_COL_C = stAnalyticInfo.xTotal2/stAnalyticInfo.nCount


Hi Curtis,

I guess you are speaking of programming your own data source: http://doc.windev.com/en-US/?1011034&name=report_programmed_data_source

The answer to your question is yes. The example is misleading in this regard. You simply have to do exactly as they describe, using the "events": "Reading the report data", "Before printing the BODY block", "After printing the Body block".

In the "Reading the report data" simply return True or False to say if you have another record to print or not. In your case, you simply have to create a global variable to know at what index you are at in your array, and when you reach the end of your array, return false.

"Reading the report data":

RETURN gIndex > aaItemAnalytics..Occurrence

"Before printing the BODY block"

// This code will not work as you intend, but this is just to illustrate:
WITH aaItemAnalytics[gIndex]
//ITEM_COL_A = sItem
ITEM_COL_B = .xTotal/.nCount
ITEM_COL_C = .xTotal2/.nCount

Best regards,
Alexandre Leclerc

von Alexandre Leclerc - am 21.06.2016 12:27
Zur Information:
MySnip.de hat keinen Einfluss auf die Inhalte der Beiträge. Bitte kontaktieren Sie den Administrator des Forums bei Problemen oder Löschforderungen über die Kontaktseite.
Falls die Kontaktaufnahme mit dem Administrator des Forums fehlschlägt, kontaktieren Sie uns bitte über die in unserem Impressum angegebenen Daten.