Easy to Create, Easy to Change - Easy to use!


CSV files - Export To vs EXECDQL


Started by Peter Birney, PB Associates
Search
You will need to Sign In to be able to add or comment on the forum!

CSV files - Export To vs EXECDQL

I am using V8.1.1.1435 (Or V8.1.0.1435 as it says in Help/About DataEase).

I am producing a CSV file using EXPORT TO in a DQL procedure and it produces it correctly (Albeit with a variable number of Carriage Return/Line Feed pairs at the end of the file).

I thought that I would try the same in EXECDQL and see the results. I pasted the DQL procedure without the EXPORT TO portion into my EXECDQLSTORE and ran it. Although it produces the same number of records as the DQL, it does not output all the required fields. It stops after 104 fields (Of over 200).

The structure of the code is as follows:-

for File A;

any File B named XXX with ..;

all File C with ....;

The fields produced are those for File A and File B, no fields from File C are output - But it works in the normal DQL procedure!

So, apart from testing that the DQL works in a DQL procedure with OUTPUT TO, then putting it into an EXECDQLSTORE and testing that it works identically this time, are there any pointers which we should be aware of regarding writing DQL which will be processed by an EXECDQL statement such that it functions in the same manner as the original DQL procedure?

Written by Peter Birney, PB Associates 16/12/13 at 11:10:33 Dataease [{8}]FIVE

Re:CSV files - Export To vs EXECDQL

Hi Pete.

No need to use Export to in ExecDQL anyway.

As we all know the Export To functionality that was "panic" implemented back when DFW 5 was released as never been what it should be nor anything close to what it was supposed to replace i.e. DFD export.

The goal in DE 8 is not to fix all the stuff that should have been fixed many years ago, but to add new and missing functionality to both suplement existing functionality and to introduce new opportunities.

With DE Reporter we will be back where DFD left, and one will be able to format DQL bodies which can be saved directly as both simple and advanced exports as well as creating advanced print formats.

ExecDQL is DQL int he opposite direction of reporting. It is DQL as procedure and function.

When we created ExecDQL it was important to retain the syntax of "normal" DQL so DQL`s could be copied from one to the other, so we didn`t remove Export To, but there is very few reasons to use it anymore.

If you want a specially formatted Export file, you have much more freedom using WriteToFile() and MemoWriteToFile(), but the easiest and fastest way to create an export file in DE 8 is simply to use ExecDQL with List Records and then add an export file name as the last parameter in the function Execution.

MemoExecDQL(MyDQL,"","","","","c:\temp\export.txt").

ExexDQL is configured so that if you have list records in the DQL it will export the result of the DQL automatically as long as you include an export name. As this is a function and the file name is the last parameter, you will of couse be able to programatically choose the export name too which is something we know a lot of users have been missing in Export To (You can do it there too, but 99.9% of the users don`t know how....)

Out goal in DE8 and the future versions of DataEase is to pick up on customer needs and try to meet them, so this is why we included the Export option in ExecDQL as a default.

The export you get is automatically formatted with column names as headers and ~ as field seperator.

for MyForm ;
list records
sum of MyRel MyPrice ;
Customername .


Will result in the following export format.

sum of MyRel Myprice~Customername
93831~British Petroleum
48483~DataEase International

If you want a different column name in the export file simply use a temp variable.

define "sumprice" number.

for MyForm ;

sumprice := sum of MyRel MyPrice .
list records
sumprice ;
CustomerName .


Result will then look like this

sumprice~CustomerName
93831~British Petroleum etc...

Written by DataEase 17/12/13 at 11:04:46 Dataease [{8}]FIVE

Re:Re:CSV files - Export To vs EXECDQL

Hi Mr. D

I have downloaded the latest version V8.1.1.1436 (Or V8.1.0.1436 as it says in Help/About - Why the difference?).

Referring to my initial posting, I get all the fields from Files A and B but none from File C, and in addition I get all the field names from Files A and B in my first record but none from File C.

There appears to be no indication that the EXECDQL is doing anything other than what is expected of it (And what it does do successfully using EXPORT TO) so there must be a difference somewhere in how the two are working.

Written by Peter Birney, PB Associates 17/12/13 at 11:47:59 Dataease [{8}]FIVE

Re:Re:Re:CSV files - Export To vs EXECDQL

Hi again.

It might well be that the Export To doesn't work the same in ExecDQL as in Traditional DQL, but what I don't understand is why you use Export To?

You don't need to use it in ExecDQL as it will generate the export "native".

Or do I misunderstand and the ExecDQL native doesn't export the correct fields?

Written by DataEase 17/12/13 at 14:24:22 Dataease [{8}]FIVE

Re:Re:Re:Re:CSV files - Export To vs EXECDQL

Hi again Mr. D

I do not use the EXPORT TO in my EXECDQL - I have simply pasted the DQL WITHOUT the EXPORT TO portion into my EXECDQLSTORE table. I then run it using the button at the bottom of the form and, as I have said before, I do not get the same result.

I am sorry to go on about this, but the likelihood is that I will be converting some old DOS databases in the New Year which contain in excess of 75 export to disk procedures and I would like to be sure that this works before trying to do everything in EXECDQL.

Written by Peter Birney, PB Associates 17/12/13 at 14:30:37 Dataease [{8}]FIVE

Re:Re:Re:Re:Re:CSV files - Export To vs EXECDQL

Hi Again Peter.

Sorry for being so slow.

Can you send us a sample that show the difference and what you do.

Send it to techsup@dataease.com

Written by DataEase 18/12/13 at 13:55:34 Dataease [{8}]FIVE