help needed

sam nicol captdan at netspace.net.au
Wed Sep 23 05:04:22 EDT 2020


Grant

You could also try

On 16/9/20, 7:10 am, "omnisdev-en on behalf of Bookit Enterprises" <omnisdev-en-bounces at lists.omnis-dev.com on behalf of bookit.grant at gmail.com> wrote:

    I am doing some code to do a data dump from Studio, for one of my clients who is moving to another vendor.

    I have the following code, which works just fine, gathers all the data, puts it in a spreadsheet named after the file format it came from:

    Do $files.$makelist($ref.$name) Returns iFilesList     ;; gather existing slots
    Do iFilesList.$redefine(iFileName)

    Calculate iPath as sys(11)
    Calculate iPath as mid(iPath,1,pos('books',iPath)-1)     ;; path to my df storage folder

    Set current list iFilesList
    For each line in list from 1 to #LN step 1     ;; get all the data from each slot
    Load from list
    If iFileName='FGlobalVariables'|iFileName='#APPLICATION'|iFileName='#SLOTS’ ; FGlobalVariables  is memory only
    Else
     Set main file {[iFileName]}
     Set read/write files {[iFileName]}
     Clear main file
     Set current list iDataTransferList
     Define list {[iFileName]}

At this point 

Set current list #L1
Define list {#S5}
Build list columns list iDataTransferList
Calculate #S2 as ''
For each line in list from 1 to #ln-1,1
     Load from list
     Calculate #s2 as con(#s2,#s1,ktab)
End for
Load from list   #ln
Calculate #s2 as con(#s2,#s1)  ;; now all your field are in a tab del string



     Repeat
        Add line to list
       Next 
     Until flag false
     Set print or export file name {[con(iPath,iFileName)]}
     Prepare for export to file {Tab-delimited}

Transmit text to print file (Add newline) {[#S2]}


     Export data iDataTransferList
     Set current list iFilesList
    End If
    End For
    Close data file

Voila the first line is your field list

    However, I would like to include the field names as the first line of the exported list, which is essentially the list definition.
    Because the list is defined by the field names, some of which are numeric, or boolean, so I think I need to export the field names first, then do the ‘Export data’ command.  But I can’t seem to wrap my old brain around how to do it.

    Any ideas you could help me with?

    Grant Thiessen

sam
    _____________________________________________________________
    Manage your list subscriptions at http://lists.omnis-dev.com
    Start a new message -> mailto:omnisdev-en at lists.omnis-dev.com 





More information about the omnisdev-en mailing list