FW: Quick system generated number

rkessler rich@thestewart.org
Sun, 7 Mar 1999 10:40:35 -0600


Here is a method.
Some detail is left out, but the idea is to create a
'sundries' record that holds the NEXT NUMBER TO
BE USED. Then access that file and grab the next
number every time you create a new record.
Would need to seed this sundries file with a number
larger than any existing number on the file you are
trying to not conflict with. Note: code below
is not bullet proof. If two or more people
are entering, and someone backs out,
an 'old' number can be put back on the
sundries record. 
===============================
Another answer to your question is to use
the LOOKUP NOTON option on the field
statement of the field you are trying to enter a
contol number for. Usually you would have
your 'customer-master' record be a reference
file then do a lookup noton of your entered
field against the like field in customer-master. 

Good Luck
Richard Kessler
rich@thestewart.org
rakessler@mindspring.com
205-969-3000
=================================
screen $SSO/ssos003 &
        activities entry 

file service-ticket     primary close

file ssm-sundries       designer close
        access via sundry-id using "TICKET"

field ticket-number of service-ticket display &
        label "Control No:" noid

;----------------------------
procedure preentry
;----------------------------
begin
        lock ssm-sundries record
        get ssm-sundries via sundry-id using "TICKET"
        let ticket-number = next-ticket-number of ssm-sundries 
        let next-ticket-number of ssm-sundries = &
                next-ticket-number of ssm-sundries + 1
        put ssm-sundries
        unlock ssm-sundries record
end

;----------------------------
procedure backout
;---------------------------
begin
        lock ssm-sundries record
        get ssm-sundries via sundry-id using "TICKET"
        if next-ticket-number of ssm-sundries = ticket-number + 1
        then begin
                let next-ticket-number of ssm-sundries = ticket-number
                put ssm-sundries
                end
        unlock ssm-sundries record
end

build

-----Original Message-----
From:	Tumulties@aol.com [SMTP:Tumulties@aol.com]
Sent:	Saturday, March 06, 1999 12:24 PM
To:	powerh-l@lists.swau.edu
Subject:	Quick system generated number

I am just learning Quick on an HP3000.  I need to create a system generated
customer-number in entry mode on quick screen.  I need to make sure the
customer-number doesn't already exist in the customer master dataset.  What
would be the apropriate technique to calculate this unique number?

Thanks

= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
Subscribe: "subscribe powerh-l" in message body to majordomo@lists.swau.edu
Unsubscribe: "unsubscribe powerh-l" in message to majordomo@lists.swau.edu
powerh-l@lists.swau.edu is gatewayed one-way to bit.listserv.powerh-l
This list is closed, thus to post to the list, you must be a subscriber.