
DQL export to **.xls or **.txt
DQL export to **.xls or **.txt
DQL does not export a sum or count value declared in the script, neither the first line (bold), nor the second one of the example.
example:
for INSTALLATIONEN with Versandauftrag >= data-entry von and Versandauftrag <= data-entry bis ;
list records
Bezeichnung ;
Auftragsnr : count ;
temp Anzahl = Auftragsnr ;
jointext ( Kunde , jointext ( ", ", Land )) ;
Kunde in groups ;
temp Gesamt .
end
.......
.items Installationen
@f[3,3] St. @f[3,1] > @f[3,4]
result:
nein St. NExT-Belichter F III > Carton Pack s.r.l., Italien
nein St. NExT-Belichter F V > Flint Group Flexographic Produ, USA
any idea?
Re:DQL export to **.xls or **.txt
the "old" built in Export to file function in DFW DQl only works on flat data i.e. not automatically aggregated data like field:sum count etc..
This is due to the fact that this aggregation is done in the GUI part of the DQL not in the prism part.
When you do a "export to" export in the DQL you simply export directly from the multiview, so what you have access to is the full set of data for all list records in one view.
define temp "SumOfAll" number .
define temp "CountOfAll" number .
for Data ;
SumOfAll := sum of Data Price .
CountOfAll := count of Data .
list records
concat("Country is: ", country) ;
SumOfAll ;
CountOfAll ;
sum of Data Price ; -- do the summation directly for the Mutlivew
count of Data .
end
export to "C:\blat\dqlexp.txt" .
.form header
.items
@f[1,1]~ @f[1,2]~ @f[1,3]~ @f[1,4]~ @f[1,5]
.end
RESULT:
Country is: Norway~ 20.27~ 3~ 20.27~ 3
Country is: UK~ 20.27~ 3~ 20.27~ 3
Country is: France~ 20.27~ 3~ 20.27~ 3
For item 2 and 3 here it will list the sum and the count but that is because they are calculated for each pass through of the DQL.
In your example you simply allocate the item value of the field to the temp, but what you need to do is to calculate the sum and allocate that to the temp variable.
You can also do the sum of and count of directly in the dql. (4 and 5)