Simplicty and flexibility!


Revised Sample - How to automatically generate Export DQL's and export all data in Application!

Started by DataEase
You will need to Sign In to be able to comment on the Blog!

Revised Sample - How to automatically generate Export DQL's and export all data in Application!

Downlaod Revised Sample!

Hi.

Sorry for the "long winded" reply. The short answer to your question is.

NO.

You can't do what you want simply because .DBE doesn't work that way. It doesn't export a table but a memory view that need to exist.

So the answer is ExecDQL and I will try to use your "problem" to get the message across.

EXECDQL is not limited like traditional DQL.

"All the data seems to be exported using the basic ?export to? command the traditional dql export."

As this was obviously not intended as an insult we will chose to not treat it as one ;-)

This not even close to what is happening.

ExecDQL is freedom!!!

For 5 minutes forget about everything you think you know about DataEase - its strengths and weaknesses - and imagine that you can do anything you like.

Everything that you have been thought is a lie. DataEase is extreemly flexible and there is no restrictions on what you can do.

Lets revert to your goal.

Which we know now is to export all the data in an application.

So since ExecDQL can be created on the fly, why don't we just create that DQL and then run it on the fly?

We have all the information we need in the Status Table for Tables . (PS! Make sure you refresh it to get it accurate).

So the DQL we need to make is this one (To Automatically Generate the DQLs that will do the export).

define "vTableName" text 52 .

define "retval" text .

retval := execdql("For AutoDQL ; Delete records .") . -- delete the existing DQL's 

For DummyMemo ; -- we have created a dummy table with a memo and one record, this is because we need a Memory Memo to build the DQL in.

for $DeStat_TableInfo$

if TableName not = vTableName then

if vTableName not = blank then

retval := memocopy(DummyMemo Memo1,"./CR ",0) . -- terminate the previous DQL and write it to the table.

enter a record in AutoDQL

TableName := vTableName ;

DQL := DummyMemo Memo1 .

end

vTableName := TableName .

retval :=MemoCopy(DummyMemo Memo1 ,concat("for ", tablename, ";/CRList Records/CR "),1) . -- Start a New DQL for a new table.

else

retval :=memocopy (DummyMemo Memo1,";/CR ",0) .

end

retval :=Memocopy (DummyMemo Memo1,concat(FldName," "),0) . -- See how we add a space on each MemoCopy, This is due to a bug where the last character is trimmed away by MemoCopy and MemoMemoCopy. It is fixed in 8.6 but ...

message FldName .

list records

TableName ;

FldName .

end

end

retval := MemoExecDQL(any ExecDQLStore with DQL Number = 013 DQL , data-entry field1 ) . -- Now we have finished generating, so time to fire the DQL below.


define "retval" text .

For AutoDQL with TableName not="Users" ; -- we run the export for all but Users.

retval := MemoExecDQL(DQL,"","","","",concat(data-entry field1,"\",TableName,".txt")) .  -- Now we run all the Scripts we generated automatically

list records

TableName in order .

PS! In the previous version of the problem we showed you how you COULD write your own Layout/format (which we could have done automatically also of course) but you don't have to have a format. ExecDQL generate a native export format if you have list records which happens to be the standard DFW export "CSV" so the only thing we need to do is to fire the DQL and point it at a automatically generated file name.

Voila.

If you say this is the same as export to again we will not be much pleased....


Written by DataEase 03/07/17 at 19:25:28
DG3_BlogList