Fwd: command line process
Nancy Palmquist
nancy.palmquist at vss3.com
Wed Mar 31 08:16:35 PDT 2021
What I think could cause an issue is that you should never select using
an index that is built on something you plan to change.
I would say that when you change entries in the index and save the
record your place in the index also changes.
I would affect these changes by sitting in one place, do a lookup to
each file using the index for the account number like this:
I want to change 10000-00001 to 10000-00001-1
I would not do this by selecting the records and changing them one at a
time in a report, I would sit on one record, I usually do this in clerk
- where is not important but maybe the customer definition record and do
the following:
loop1
lookup filename k=("10000-00001 ") i=a -nxp
if not filename
end
if "10000-00001~" eq filename(1){"~" then filename(1)="10000-00001
-1";write filename
' now that just moved the record to another place in the index since
index A is built on the 13 characters of the account number.
'so now all I have to do is repeat this logic until I find no more
entries to change.
'It is important to include the spaces in the key used in the lookup but
I also test to make sure I am finding the right thing before I make a
change to the data.
goto loop1
By this method, you can sit on that one record and make all the account
number changes in all the files that need to be updated in just a few
loops. Now I used data, but you might use variables of course. I just
thought it would be clearer with literal data.
This logic is also worthwhile to delete all associated records. Say I
want to purge all my files of one invoice number, I would do the same
type of logic. Or I want to archive all the stuff related to one
customer or one invoice. The indexes are wonderful in this regard. It
has to be an automatic index, since it is updated as you go. This is
also much faster that running reports on each file you want to fix.
Nancy
On 3/30/2021 3:55 PM, scooter6--- via Filepro-list wrote:
> So apparently it's necessary to make fa a global in changeacctnumsel
> It works if I put fa(11,allup,g)=@px and then run
> /u/appl/fp/dreport filename -f changeacctnum -rx 10000-00001 -u -a -v
> changeacctnumsel -ia
>
> FYI
>
>
>
>
> ---------- Forwarded message ---------
> From: scooter6 at gmail.com <scooter6 at gmail.com>
> Date: Tue, Mar 30, 2021 at 11:34 AM
> Subject: command line process
> To: filePro Mailing List <filepro-list at lists.celestial.com>
>
>
> I have the following
>
> /u/appl/fp/rreport filename -f changeacctnum -u -a -v changeacctnumsel -ia
>
> (Index A is the field to be changed)
>
> changeacctnumsel looks like this
>
> If: fa=""
> Then: input fa(11,allup) "Enter acct to change"
>
> If: 1 lt fa
> Then: lookup - k=fa i=A -eg
>
> If: 1 gt fa
> Then: la(11,allup)="99999-99999"
>
> If: 1 gt fa
> Then: lookupu - k=la i=A -el
>
> If: 1 lt fa
> Then: end
>
> If: 1 gt fa
> Then: end
>
> If:
> Then: select
>
> This works perfectly - my processing changeacctnum runs fine and does what
> I want it to do
>
> However, if I change the first line to be :
>
> If:
> Then: fa(11,allup)=@px
>
> ...and rest of code is the same, and I run this from the command line
>
> /u/appl/fp/dreport filename -f changeacctnum -rx 10000-00001 -u -a -v
> changeacctnumsel -ia
>
> I get no errors but it doesn't do what changeacctnum processing is
> supposed to do
>
> I have tried it with "10000-00001" in quotes also but same result
>
> What I'm trying to do is write a process that will change acct number if
> there needs to be an 'associate' account number - so the field in question
> is actually 13 characters long
> So I'm wanting to change all records it finds that are 10000-00001 to
> 10000-00001-1
> As I said, this works fine if changeacctnumsel doesn't try to use @px but
> there are several files I need to add the -1 to so rather than someone
> having to input the account number multiple times, I'm trying to pass it as
> -rx flag to the other files so user inputs 10000-00001 just once and it
> makes changes to all pertinent files
>
> What am I missing here?
>
> thanks
>
> Scott
> PDM
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL: <http://mailman.celestial.com/pipermail/filepro-list/attachments/20210330/59488ba1/attachment.html>
> _______________________________________________
> Filepro-list mailing list
> Filepro-list at lists.celestial.com
> Subscribe/Unsubscribe/Subscription Changes
> http://mailman.celestial.com/mailman/listinfo/filepro-list
--
Nancy Palmquist MOS & filePro Training Available
Virtual Software Systems Web Based Training and Consulting
PHONE: (412) 835-9417 Web site: http://www.vss3.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.celestial.com/pipermail/filepro-list/attachments/20210331/5d3fc375/attachment.html>
More information about the Filepro-list
mailing list