
Generating a DQL export with a double records output
Generating a DQL export with a double records output
Hi dataease, I have some trouble to generate an export from a file that can produce more than one record in output. For example Look at this simple dql:
define "Type" text 5 .
for TableA ;
if (fieldA + FieldB) >0 then
assign temp Type := "(A+B)" .
list records
temp type ;
(FieldA + fIELDB) ;
FieldA ;
FieldB ;
FieldC ;
FieldD .
end .
end .
for TableA ;
if (fieldC + FieldD) > 0 then
assign temp Type := "(C+D)" .
list records
temp type ;
(FieldC + fIELDd) ;
FieldA ;
FieldB ;
FieldC ;
FieldD .
end .
end .
export to "V:\MyFile.txt" .
Type~Sum~FieldA~FieldB~FieldB~FieldC~FieldD
.items TableA
@f[1,1,5]~@f[1,2,8]~@f[1,3,8]~@f[1,4,8]~@f[1,5,8]~@f[1,6,8]
.end
The goal is :
1) I want to obtain only one file in output
2) if the sum of filedA+fieldB > 0 and the sum of fieldC+FieldD is > 0 the report MUST generate 2 records 1 for A+B and one for C+D
3) I don't want create a separate DQL for each of them because I will have two files in output ..
4) The report doesn't generate blank line.
5) I tried to add form number 2 but it doesn't works
6) I don't want create an additional table for this and export data after loading process. (I already have a large amount of tables in my databases...)
There's a simply solution for this?
here the output file MyFile.txt and in attach the tableA
Type~Sum~FieldA~FieldB~FieldB~FieldC~FieldD
(A+B)~ 19 ~ 12 ~ 7 ~ 78 ~ 34
(A+B)~ 46 ~ 22 ~ 24 ~ 0 ~ 0
(A+B)~ 10 ~ 10 ~ 0 ~ 15 ~ 0
(A+B)~ 20 ~ 0 ~ 20 ~ 0 ~ 25
Thanks
Re:Generating a DQL export with a double records output
The simplest way to do this is to do it the manual way.
Forget about list records and export and simply create the file on the fly.
WriteToFile()
http://www.dataease.com/dg3_HelpView/?PageID=10327...
You can also solve this with MemoExecDQL() but something as simple as this is quicker to design via WriteToFile where you can design the output exactly like you want.