existing utility to convert filePro key to csv. oops wrong version

Richard D. Williams richard at appgrp.net
Thu Oct 10 11:48:08 PDT 2013


Scott Nelson just told me the attachment was getting "scrubbed".
I changed it to a txt file . Hopefully this will correct the issue.

Richard

On 10/10/2013 12:58 PM, Richard D. Williams wrote:
> please see attached for the corrected version.
>
> Richard
>
> On 10/10/2013 12:48 PM, Richard D. Williams wrote:
>> On 10/9/2013 1:02 PM, William J. McEachran wrote:
>>> I seem to recall that someone here has a program to convert filePro
>>> key/data to csv using the map as the header line.
>>>
>>> Could they contact me off list and save me re-inventing that wheel.
>>>
>>> Thanks.
>>> -------------- next part --------------
>>> An HTML attachment was scrubbed...
>>> URL: http://mailman.celestial.com/pipermail/filepro-list/attachments/20131009/55f2f1ef/attachment.html
>>> _______________________________________________
>>> Filepro-list mailing list
>>> Filepro-list at lists.celestial.com
>>> Subscribe/Unsubscribe/Subscription Changes
>>> http://mailman.celestial.com/mailman/listinfo/filepro-list
>>>
>>>
>>>
>> To All:
>>
>> I have made a very good living and life because of filepro.
>> I wrote this little piece of code for a client, but never got paid for it.
>>
>> I would like to make a gift to filepro and it's users.
>> Please feel free to use it anyway you wish.
>>
>> (see attached)
>>
>> Richard D. Williams
>>
>> P.S. Please do not flame me on this. It's just a gift.
>> Also, please change the file name to prc.expfpfile.
>> It may need some tweaking for FP Windows.
>> -------------- next part --------------
>> A non-text attachment was scrubbed...
>> Name: prc-expfpfile_csv
>> Type: application/octet-stream
>> Size: 3190 bytes
>> Desc: not available
>> Url : http://mailman.celestial.com/pipermail/filepro-list/attachments/20131010/057ba5a0/attachment.obj
>> _______________________________________________
>> Filepro-list mailing list
>> Filepro-list at lists.celestial.com
>> Subscribe/Unsubscribe/Subscription Changes
>> http://mailman.celestial.com/mailman/listinfo/filepro-list
>>
>>
>>
> -------------- next part --------------
> A non-text attachment was scrubbed...
> Name: prc-expfpfile_csv
> Type: application/octet-stream
> Size: 3247 bytes
> Desc: not available
> Url : http://mailman.celestial.com/pipermail/filepro-list/attachments/20131010/389d703e/attachment.obj
> _______________________________________________
> Filepro-list mailing list
> Filepro-list at lists.celestial.com
> Subscribe/Unsubscribe/Subscription Changes
> http://mailman.celestial.com/mailman/listinfo/filepro-list
>
>
>

-------------- next part --------------
end::end:
@keyR::PUTENV "PFADDWP","OFF":
::declare STDPATH:
::PF=GETENV("PFDIR"){"/filepro/":
::STDPATH=GETENV("PFDIR"){"/fpexport/";b(1)=exists(STDPATH):
:b eq "0":system "mkdir"<STDPATH{";chmod 775"<STDPATH{";chown fileprousers"<STDPATH:
::dim ALLQUAL(100):
::declare QUAL;rn(8,.0)="1":
:dd eq ""        'use for export filenames:dd(8,yymd)=@TD+"0";tm=mid(@TM,"1","2"){mid(@TM,"4","2"){mid(@TM,"7","2"):
::input popup ("22","") ha(30) "Enter Filepro Filename>":
:ha eq "":msgbox "No export done!";exit:
::l=PF{ha;b(1)=EXISTS(l):
:b eq "0":msgbox l<"does not exist!";exit:
::l=l{"/map";b=EXISTS(l):
:b eq "0":msgbox ha<"does not have a \"map\"!";exit:
::gosub lokqual:
:p eq "2":goto cont:
::show "Press [ENTER] to make your selection":
::n=listbox(ALLQUAL,"1",p,"","","",""):
:n lt "1" or n gt p:msgbox "No selection made!";exit:
:n eq "1":QUAL="";goto askqual:
:n eq "2":QUAL="ALL QUALIFERS";goto askqual:
::QUAL=ALLQUAL(n):
askqual:not(QUAL co "ALL QUALIFERS"):input popup ("22","") q(1,yesno) "You want to export \"key"{QUAL{"\" for"<ha{"? (Y/N)":
:QUAL co "ALL QUALIFIERS":input popup ("22","") q(1,yesno) "You want to export all qualifers for"<ha{"? (Y/N)":
:q ne "y":msgbox "No Export Done!";exit:
cont:QUAL eq "":w=ha{"@";gosub expdata;goto done:
:QUAL ne "" and not(QUAL co "ALL QUALIFERS"):w=ha{"@"{QUAL;gosub expdata;goto done:
::n="":
cnt::n=n+"1":
:n gt "100":n="";goto done:
:ALLQUAL(n) eq "":n="";goto done:
::w=ha{"@"{ALLQUAL(n);gosub expdata;xx="":
::goto cnt:
expdata:xx eq "":gosub getmap;f="NOT BLANK";gosub wrtit;n="":
::lookup data = (w) r=rn -ng:
chkdata:not data:close newdata;return:
:hc eq "":hc(8,.0)=NUMFIELD(data):
::n="":
:x ne "":goto dodata:
cnthead:'heading:n=n+"1":
:n gt hc:n="";x(1)="x";f="NOT BLANK";gosub wrtit;goto expdata:
:                'data for export csv:'z=z{"\""{FIELDNAME(data,n){"\",":
:                'data for export pipe:z=z{FIELDNAME(data,n){"|":
::goto cnthead:
dodata:        'create a string of data values:n=n+"1":
:n gt hc:n="";gosub wrtit;getnext data;goto chkdata:
:                'export csv:'z=z{"\""{FIELDVAL(data,n){"\",":
:                'export pipe:z=z{FIELDVAL(data,n){"|":
:        'make sure we have data to export:f=f{FIELDVAL(data,n):
::goto dodata:
lokqual::fa=STDPATH{"KEYS_"{dd{tm:
::l=PF{"/"{ha{"/key*";system "ls -1"<l<">"<fa:
::debug on:
::clear ALLQUAL;n(3,.0)="";ALLQUAL("1")="key only";ALLQUAL("2")="ALL";n="2":
lokkeys::import ascii keys = (fa) r=\n f=\r:
:not keys:p=n;return:
::z=""{keys(1):
:not(z co "key"):goto lokkeys:
::p(3,.0)=instr(z,"key");hb=""{mid(z,p+"3","20"):
:hb ne "":n=n+"1";ALLQUAL(n)=hb:
:n eq "100":p=n;n="";return:
::goto lokkeys:
getmap::l=PF{ha{"/map";xx(1)="x":
::import ascii map = (l) r=\n f=\r:
::z=map(1);close map:
::'import ascii num = (l) r=\n f=^A:
::'hc(8,.0)=num(4):
::return:
wrtit:f eq ""         'nothing really to export:return          'z may have quotes with no field values:
:QUAL eq "":fa=STDPATH{ha{"_"{dd{tm{".csv":
:QUAL ne "":fa=STDPATH{ha{"_"{QUAL{"_"{dd{tm{".csv":
::export ascii  newdata = (fa) r=\n f=\r:
::newdata(1)=z;z="";return:
done::msgbox "Exports Completed!\nSee"<STDPATH{ha<" with today's date & time.\n"{dd{tm{".":
::exit:


More information about the Filepro-list mailing list