Exporting data from aspect and subforms

Moderators: Phil Winkler, Graham Smith, Pete Tabord

Exporting data from aspect and subforms

Postby KjetilUrne » Thu Feb 02, 2017 9:30 am

The time difference between regular Export ("File | Export") and procedural scripts ("TextOutLn") is striking when a "large" number of records is involved. Though i prefer the latter, i don't find it viable when the number of records exported exceed 10000.

So, I created this aspect, with subforms, in order to export - only to find that there is no direct way to export the data from the subs. Is there a tweak to this?

(There's one-to-one relations involved, so I could fix it by making virtuals in the parent form, but rather not)
KjetilUrne
 
Posts: 602
Joined: Mon Oct 08, 2007 8:21 am
Location: Norway
Has thanked: 4 times
Been thanked: 1 time
 

Re: Exporting data from aspect and subforms

Postby Adrian Jones » Fri Feb 03, 2017 9:45 am

No -- the export function only works on either the current main form data, or the current subform data, but not both.

But there is also a question of what sort of output are you looking for -- something that maintains the data structure (basically, XML) or something that flattens/denormalises it.

If the latter, you could add the fields you want to export from the parent table as virtuals and export all the data from the sub table instead.

In terms of speed using textout, something to try: change the file after x records.

I suspect speed issues will be to do with constantly opening and closing an every-increasing file, but if you periodically rename the file you are exporting to, I'm guessing the performance might improve.

Something like:

define "tCounter" number .
define "tFileNumber" numeric string .
define "tFileName" text 255 .
define "t" number .

tCounter := 1 .
tFileNumber := 01 .
tFilename := "MyData01.dat" .

for Stuff ;
if tCounter > 5000 then
tCounter := 1 .
tFileNumber := tFileNumber + 1 .
tFileName := concat ( "MyData" , tFileNumber , ".dat" ) .
end -- if tCounter
t := textoutln ( tFileName , [Data to output] ) .
tCounter := tCounter + 1 .
end -- for Stuff

You could then join the files together at the end of the routine.
User avatar
Adrian Jones
 
Posts: 2000
Joined: Tue Sep 11, 2007 2:38 pm
Location: Cornwall, UK
Has thanked: 5 times
Been thanked: 4 times
 

Re: Exporting data from aspect and subforms

Postby KjetilUrne » Fri Feb 03, 2017 6:33 pm

Thanks, Adrian!

I managed to reduce processing time with approx 60% by dividing the file into 6 parts / 3000+ records (going even further appeared to be counter-productive in my somewhat non-academic research).

I 'messaged' the tCounter and noticed the speed going up and down quite a bit. Also noticed Ffenics.exe CPU consumption varied quite a bit during the process. Could have been something with the computer of course, but not much else was going on at the moment.
KjetilUrne
 
Posts: 602
Joined: Mon Oct 08, 2007 8:21 am
Location: Norway
Has thanked: 4 times
Been thanked: 1 time
 
 

Return to Ffenics 1.x

Who is online

Users browsing this forum: No registered users and 7 guests