Filepro Export Help - hopefully last email...

Brian K. White brian at aljex.com
Tue Jan 18 21:50:23 PST 2005


----- Original Message ----- 
From: "Matthew Williams" <matthew.d.williams at gmail.com>
To: "FilePro Mailing List" <filepro-list at lists.celestial.com>
Sent: Tuesday, January 18, 2005 4:49 PM
Subject: Re: Filepro Export Help - hopefully last email...


> Everything was fixed, the culprit was the first IF statement: If: rc
> ne 1 or rc ne ""
>
>
> Thanks for all the help and patients and I can't believe that was the
> problem all along... Just one of those "duh" moments I guess.  Just
> took a few sets of eyes to figure out what was going on.
>
> Take care everything.
>
> Case closed,
> -Matt Williams
> Hale Mfg.
> www.halebookcases.com
>
>
> On Tue, 18 Jan 2005 16:43:08 -0500, Brian K. White <brian at aljex.com> 
> wrote:
>>
>> ----- Original Message -----
>> From: "Matthew Williams" <matthew.d.williams at gmail.com>
>> To: <brian at aljex.com>
>> Sent: Tuesday, January 18, 2005 4:00 PM
>> Subject: Filepro Export Help - hopefully last email...
>>
>> > You have a lot of patients and I thank you a lot! :)  I updated my
>> > code I think to how you said it should be in terms of writing the
>> > header and such but I wasn't sure about updating the second line.
>> > Here is my code as it is right now where it only selects the first
>> > record for each RepCode:
>> >
>> > 
>> >  -------   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -    
>> > -
>> >      If: rc ne 1 or rc ne ""
>> >      Then: close rep
>> > 
>> >  -------   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -    
>> > -
>> >      If: rc ne 1
>> >      Then: rc(3,*,g)=1 ; of = "/upss/invoices/"{1{".txt"; gosub header
>> > 
>> >  -------   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -    
>> > -
>> >      If: ' Writes my fields out
>> >      Then: rep(1)=1; ..... end
>> >
>> 
>> >   -------   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -   
>> >  -
>> > exp  If:
>> >      Then: export word rep = (of) -r=\n -f=,
>> >
>> 
>> >   -------   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -   
>> >  -
>> >      If:
>> >      Then: return
>> >
>> 
>> >   -------   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -   
>> >  -
>> > header If:
>> >      Then: gosub exp
>> >
>> 
>> >   -------   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -   
>> >  -
>> >      If: ' Export file header
>> >      Then:
>> > rep(1)="SalesPerson";rep(2)="OrderNumber";rep(3)="AccountNumber"
>> >
>> 
>> >   -------   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -   
>> >  -
>> >      If:
>> >      Then: write; return
>> >
>> > I'm guessing my flaw is somewhere in lines 1 or 2?  Somehow its
>> > closing out the file before getting to the rest of the records?
>> > Currently it reads the first record for that particular RepCode then
>> > jumps to the next RepCode, writes the first record, etc etc.
>> >
>> > This is the last thing holding me back from finishing this project, I
>> > just with it would magically work!  If you think you've got the fix
>> > let me know what line to fix.
>> >
>> > As you can tell i'm in no way a FilePro developer... I just sorta do
>> > what I can for this business when i'm home from school on breaks.  It
>> > is however interesting stuff and I would use this over Access any day
>> > of the week!
>> >
>> > Thank you so much!
>> >
>> > Take care,
>> > -Matt Williams
>> > Hale Mfg.
>>
>> I already went through all the work of showing how to do what you want,
>> there is nothing I can say here that is any different than the fp list 
>> post.
>> The code above is not a starting point that can be tweaked slightly to 
>> work,
>> it requres more re-arranging than that. I did that re-arranging already 
>> so
>> there is no point in doing exactly the same thing here.

I don't know why I didn't notice that the "the code above" was in fact at 
least reasonable approximation of the code I'd suggested. I was responding 
as if you were still trying to use the original table. Sorry about that.

> When it would come around to the second record it would test "rc ne
> """, of course the second time around rc was populated so it would
> close out the file and jump to the next being the reason why I would
> only get the first record.
>
> I took out that part of the IF statement and like magic everything
> works.  I'm getting every record for every RepCode like I should be.

I'd put the test back, but the way I posted, with "and" :)
Without the 2nd half of the first test, then once at the beginning of each 
job, you are closing something that doesn't exist yet. I guess if you say 
it's working then you must not be getting an error but to me, that's an 
error. Maybe fp is playing nice and gracefully dealing with it but I 
wouldn't rely on something like that. It might not work with the next update 
or on some other version of windows or on some other platform etc... How to 
put it... Even if an illogical thing happens to work, you still shouldn't 
expect it to or rely on it continuing to.

consider the state when rreport first starts running,
were on record 1 (well, the first selected record)
rc has never been set yet, it's ""
field 1 is some value, it's your lowest rep code like AAA or 001

at this point, rc does not equal field 1
yet we don't want to "close rep" because the lookup alias "rep" hasn't been 
created yet.

So the 2nd half of the test makes it so that we close rep whenever 1 isn't 
the same as rc  and  rc is not empty.
which comes out as every time the rep changes from one rep to another but 
not at the start of the first rep.

Brian K. White  --  brian at aljex.com  --  http://www.aljex.com/bkw/
+++++[>+++[>+++++>+++++++<<-]<-]>>+.>.+++++.+++++++.-.[>+<---]>++.
filePro BBx  Linux SCO  Prosper/FACTS AutoCAD  #callahans Satriani



More information about the Filepro-list mailing list