Page Index Toggle Pages: 1 [2]  Send Topic Send Topic Print Print
Hot Topic (More than 10 Replies) Globalvalue (Read 3915 times)
Carl Underwood
Senior Member
Members
*****
Offline



Posts: 1351
Location: New Hampshire
Joined: Mar 11th, 2003
Re: Globalvalue
Reply #15 - Aug 8th, 2004 at 3:13am
Print Post Print Post  
Wouldn't using something like the following code solve a lot of the problems discussed in this thread?

It does not rely on the state of the db or dsr, but on the state of the data itself. I've been using this type of code for years with great results. If used in a client/server setup, it can be place in an OnFormExit event so that it is not generating more than one form with the same number.

Code
Select All
If InvNo = "" then
     InvNo = @XLookupR(@fn, 99999, "InvNo", "InvNo") + 1 

  


Carl Underwood
CDU Computer Consulting LLC
Epsom, New Hampshire
Back to top
IP Logged
 
The Cow
YaBB Administrator
*****
Offline



Posts: 2530
Joined: Nov 22nd, 2002
Re: Globalvalue
Reply #16 - Aug 8th, 2004 at 1:18pm
Print Post Print Post  
Carl,

Yes, if you are using Global Values to generate and retain a highest-unique number and that number is stored in the record.

There are as many uses for a tagged globally-available untyped value as there are stars in the sky.
  

Mark Lasersohn&&Programmer&&Lantica Software, LLC
Back to top
IP Logged
 
Steve_in_Texas
Senior Member
*****
Offline


No personal text

Posts: 893
Location: San Antonio
Joined: Feb 21st, 2004
Re: Globalvalue
Reply #17 - Aug 25th, 2004 at 10:54pm
Print Post Print Post  
Just FYI - I could not get Carls much suggested xlookup to work for me until I modified the line to:

if @isblank(Stock nu) then stock nu = @tonumber(@xlookupR(@FN, 99999, "stock nu", "stock nu")) + 1

Maybe because my Stock number field or becuae xlookups return string variables.

Either way, I'm just posting this in case someone else needs it.

Thanks for the great suggestion!

Steve
  
Back to top
IP Logged
 
Carl Underwood
Senior Member
Members
*****
Offline



Posts: 1351
Location: New Hampshire
Joined: Mar 11th, 2003
Re: Globalvalue
Reply #18 - Aug 26th, 2004 at 4:06am
Print Post Print Post  
Steve,

You're correct!

Sorry. That code was out of Q&A, which isn't as stict as Sesame regarding data types.

A couple of other notes:

1) Be sure to use FormName with the external key parameter if you have more than one form containing LE's with the same name. Actually, it's probably a good idea to ALWAYS use the FormName like this:
@XLookupR(@FN, key, "FormName!ext key", "ext source")

2) Also make sure that the external key data type is not "text". Because it will find "9999" as being higher than "10000" since it will start to sort text on the 1st character rather than the whole number. And of course, "9" is higher than "1".
  


Carl Underwood
CDU Computer Consulting LLC
Epsom, New Hampshire
Back to top
IP Logged
 
Steve_in_Texas
Senior Member
*****
Offline


No personal text

Posts: 893
Location: San Antonio
Joined: Feb 21st, 2004
Re: Globalvalue
Reply #19 - Aug 26th, 2004 at 1:35pm
Print Post Print Post  
Thanks Carl,

helpful info. I'll go take a closer look at my forms.

Steve
  
Back to top
IP Logged
 
Page Index Toggle Pages: 1 [2] 
Send Topic Send Topic Print Print