Normal Topic reset @number (Read 1096 times)
09510951
Member
*
Offline



Posts: 33
Location: Hulshorst, the Netherlands
Joined: Jul 21st, 2008
reset @number
Aug 29th, 2008 at 10:44am
Print Post Print Post  
I've designed an Invoice database with @number in it for the invoice number.
While testing ofcourse I used up some numbers. How do I reset it to 1?
  
Back to top
 
IP Logged
 
Carl Underwood
Senior Member
Members
*****
Offline



Posts: 1350
Location: New Hampshire
Joined: Mar 11th, 2003
Re: reset @number
Reply #1 - Aug 29th, 2008 at 12:02pm
Print Post Print Post  
You do it in Designer. See pages 158 and 159 in user guide under Application Property Manager ("Sesame_2_User_Guide.pdf").
  


Carl Underwood
CDU Computer Consulting LLC
Epsom, New Hampshire
Back to top
IP Logged
 
NICEBERG
Full Member
Members
***
Offline


I came, I saw, I'm still
trying to figure it out!

Posts: 208
Location: Green Bay, WI
Joined: Dec 17th, 2003
Re: reset @number
Reply #2 - Aug 29th, 2008 at 5:22pm
Print Post Print Post  
I typically don't use @number - too many opportunities to "lose" a number. Rather I use the following:

if @add then
{
  if @IsBlank(Rec_No0) then Rec_No0 = @ToNumber(@XLR(@Fn, 99999999, "Rec_No0", "Rec_No0")) +1
}

In this case the element name that gets the "number" is named:  Rec_No0

This will look into your file for the last "highest" number and add 1.

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



Posts: 1350
Location: New Hampshire
Joined: Mar 11th, 2003
Re: reset @number
Reply #3 - Aug 30th, 2008 at 2:07pm
Print Post Print Post  
I only answered the question directly, without adding any recommendations, but...

Fred is right. You're usually better off using something more like he suggested. I never use @Number either. @XLookupR is my preferred method.

If you needed more than one auto-incrementing number, you could also use a GlobalValue. But @XLookupR ensures that you don't end up skipping numbers if a record is started, then discarded before being committed to disk. Also, you never have to "reset" it -- you simply delete the test records, and it will automatically start producing the correct number for you.
  


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



Posts: 33
Location: Hulshorst, the Netherlands
Joined: Jul 21st, 2008
Re: reset @number
Reply #4 - Aug 31st, 2008 at 5:41am
Print Post Print Post  
Very usefull tips, thanks. I have another number problem but I'll post that in a new topic.
  
Back to top
 
IP Logged