|
server
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Need Help with Randomized and Incremental Numbering
I'm trying to set a variable to a call of ticket_ID from table tickets of the
most recent ID. Basically I want to call the most recent number in the column ticket_ID and add 1000 to it to make a 4 digit #. What I've got is this: user_details=split(request("ticket_userID") ,"/") Q=request("ticket_id") R = (1000 + Q) ticketid=user_details(0) & cstr(R) user_name=user_details(1) This (plus more before) makes the 4 digit user ID combine with the 4 digit number (which I need to be incremental, not random) to make an 8 digit ticket number which makes the ticket origins easy to trace, and allows me to keep track of the number of tickets created. Any ideas on how to make it simple? The ticket_ID field is AutoNumbered right now so it's going up incrementally, I just want to add 1000 to that and user that equation as R. I'm stumped. Show quote
"Corey Forman" <CoreyFor***@discussions.microsoft.com> wrote in message I don't understand. Do you want to generate a random 4 digit number, or do news:B11B3135-D165-4A5D-A5F2-786493C1F452@microsoft.com... > I'm trying to set a variable to a call of ticket_ID from table tickets of > the > most recent ID. Basically I want to call the most recent number in the > column > ticket_ID and add 1000 to it to make a 4 digit #. What I've got is this: > > user_details=split(request("ticket_userID") ,"/") > Q=request("ticket_id") > R = (1000 + Q) > ticketid=user_details(0) & cstr(R) > user_name=user_details(1) > > This (plus more before) makes the 4 digit user ID combine with the 4 digit > number (which I need to be incremental, not random) to make an 8 digit > ticket number which makes the ticket origins easy to trace, and allows me > to > keep track of the number of tickets created. Any ideas on how to make it > simple? The ticket_ID field is AutoNumbered right now so it's going up > incrementally, I just want to add 1000 to that and user that equation as > R. > I'm stumped. > you want to increment some other number? Also, adding 1000 to a number may not result in a 4 digit number. Maybe you want to use leading zeros. If you add 1000, you could Modulo 1000, but then the number may not be unique. Can Q ever exceed 1000? Show quote
"Richard Mueller [MVP]" wrote: I kinda want to do both.> > "Corey Forman" <CoreyFor***@discussions.microsoft.com> wrote in message > news:B11B3135-D165-4A5D-A5F2-786493C1F452@microsoft.com... > > I'm trying to set a variable to a call of ticket_ID from table tickets of > > the > > most recent ID. Basically I want to call the most recent number in the > > column > > ticket_ID and add 1000 to it to make a 4 digit #. What I've got is this: > > > > user_details=split(request("ticket_userID") ,"/") > > Q=request("ticket_id") > > R = (1000 + Q) > > ticketid=user_details(0) & cstr(R) > > user_name=user_details(1) > > > > This (plus more before) makes the 4 digit user ID combine with the 4 digit > > number (which I need to be incremental, not random) to make an 8 digit > > ticket number which makes the ticket origins easy to trace, and allows me > > to > > keep track of the number of tickets created. Any ideas on how to make it > > simple? The ticket_ID field is AutoNumbered right now so it's going up > > incrementally, I just want to add 1000 to that and user that equation as > > R. > > I'm stumped. > > > > I don't understand. Do you want to generate a random 4 digit number, or do > you want to increment some other number? Also, adding 1000 to a number may > not result in a 4 digit number. Maybe you want to use leading zeros. If you > add 1000, you could Modulo 1000, but then the number may not be unique. Can > Q ever exceed 1000? > > -- > Richard Mueller > Microsoft MVP Scripting and ADSI > Hilltop Lab - http://www.rlmueller.net > -- > > > What I'm hoping to accomplish is to combine a 4 digit ticket_UserID with an incremental 4 digit number (I want it to start at 1) to make an 8 digit #. Right now when I create a user, it gives him an ID. When this new user creates a document, I want it to take his userID (say 4444) and generate a second separate incremental number (starting at 1 or 1001) and put the two together to post an 8 digit ticketID of 44441001 to the table. That way I can identify the creator of the document by user, and how many documents the user has created. So the next time he creates another document, it will be doc 44441002, but when someone else creates a document it will be their userID as the first 4 digits, and 1001 as the second 4. If I can't get that to work properly (which I've been trying to do for almost a month now) then I just want the creation of a document to create and generate a number which incrementally climbs by 1 from the last value posted in the table. Show quote
"Corey Forman" wrote:
> I'm trying to set a variable to a call of ticket_ID from table tickets of the > most recent ID. Basically I want to call the most recent number in the column > ticket_ID and add 1000 to it to make a 4 digit #. What I've got is this: > > user_details=split(request("ticket_userID") ,"/") > Q=request("ticket_id") > R = (1000 + Q) > ticketid=user_details(0) & cstr(R) > user_name=user_details(1) > > This (plus more before) makes the 4 digit user ID combine with the 4 digit > number (which I need to be incremental, not random) to make an 8 digit > ticket number which makes the ticket origins easy to trace, and allows me to > keep track of the number of tickets created. Any ideas on how to make it > simple? The ticket_ID field is AutoNumbered right now so it's going up > incrementally, I just want to add 1000 to that and user that equation as R. > I'm stumped. > |
|||||||||||||||||||||||