Normal Topic Auto numbers (Read 697 times)
debmckee
Full Member
***
Offline



Posts: 123
Joined: Oct 5th, 2011
Auto numbers
Oct 31st, 2011 at 9:19pm
Print Post Print Post  
I entered this statement (gotten off your knowledge base) to assign auto numbers in a Sales Memo.

// Only assign the number if
// this is a new record which
// has been changed.

var vNextNum as int

If(@IsNew)
{
    If(@Modified)
    {
        vNextNum = @ToNumber(@GlobalValue("NextNumber")) + 1
        le1 = vNextNum
        GlobalValue("NextNumber", @Str(vNextNum))
    }
}

It works fine, but it starts at Number 1.  Can and where would I put a starting number other than 1?

I have several forms in my application that use auto numbering so have to do it via programming.
  
Back to top
 
IP Logged
 
Steve_in_Texas
Senior Member
*****
Offline


No personal text

Posts: 893
Location: San Antonio
Joined: Feb 21st, 2004
Re: Auto numbers
Reply #1 - Oct 31st, 2011 at 9:28pm
Print Post Print Post  
Deb,

In Sesame Designer>Application>Application Property Manager, you will see a field to enter @Number (third field from the top). Enter your starting number, then reconcile.

During Reconcile, be sure to select 'YES' to the 2nd reconcile setting labeled "Should Reconcile replace the @Number setting in the target Application?".

That should do it.

Steve

Edit..oops, just noticed your using Globalvalues. You can simply use programming to set the initial value. The example below would set the number to 999. Change as needed, and only run it once. Your code will work fine for subsequent numbers.

GlobalValue("NextNumber","999")
  
Back to top
IP Logged
 
Steve_in_Texas
Senior Member
*****
Offline


No personal text

Posts: 893
Location: San Antonio
Joined: Feb 21st, 2004
Re: Auto numbers
Reply #2 - Oct 31st, 2011 at 10:01pm
Print Post Print Post  
Glad to hear it worked. We were all 'newbie's at one point, so no one is laughing Wink

If you want 'LE1' to display the number without comma's, you need to change the 'display format' of that field in Sesame Designer.

In Designer, open the form with the LE to update. Highlight the LE. On the Property Editor, click Format tab, choose Selected Elements>Custom Format>Group Digits>No.

Hope that helps!

Steve
  
Back to top
IP Logged
 
debmckee
Full Member
***
Offline



Posts: 123
Joined: Oct 5th, 2011
Re: Auto numbers
Reply #3 - Oct 31st, 2011 at 10:58pm
Print Post Print Post  
I kind of thought of that later......so went in and removed post.  No sense in looking new AND stupid!

Thank you for all your help!
  
Back to top
 
IP Logged
 
Steve_in_Texas
Senior Member
*****
Offline


No personal text

Posts: 893
Location: San Antonio
Joined: Feb 21st, 2004
Re: Auto numbers
Reply #4 - Oct 31st, 2011 at 11:32pm
Print Post Print Post  
Glad to hear you're making progress!
  
Back to top
IP Logged
 
debmckee
Full Member
***
Offline



Posts: 123
Joined: Oct 5th, 2011
Re: Auto numbers
Reply #5 - Nov 4th, 2011 at 8:49pm
Print Post Print Post  
Unfortunately it returns exactly what it says!

EVERY record is the global value plus 1

I haven't been saving my preview records so had not noticed that until now!!


  
Back to top
 
IP Logged
 
Steve_in_Texas
Senior Member
*****
Offline


No personal text

Posts: 893
Location: San Antonio
Joined: Feb 21st, 2004
Re: Auto numbers
Reply #6 - Nov 4th, 2011 at 9:49pm
Print Post Print Post  
Setting the global value to '999' (the command I sent you) should only be used ONE time to set the globalvalue initially. After that, simply use the code you posted and you should be all set.

  
Back to top
IP Logged