Gossamer Forum
Home : Products : DBMan : Customization :

same ID

Quote Reply
same ID
 
i now understand that the db_key is first checked to ensure no duplication of keys before writing to the default database. now, i have this problem. my db_key field is "Number" and i have a field named "DocNum" which has the following format: <text>$Number.

what part of db.cgi shld i modify so that i could make sure that "DocNum" gets the right $Number?

Quote Reply
Re: same ID In reply to
Let me see if I understand this correctly.

In your form, you have a field called "DocNum," into which is entered some sort of text. You also have a counter field called "Number," which is the $db_key. When a record is added, you want the "DocNum" field to be changed so that the value of the "Number" field is appended to the end of whatever text was entered in the "DocNum" field. Yes?


------------------
JPD





Quote Reply
Re: same ID In reply to
 
yes, that's what i supposed to do. using 2 computers, i (we actually) did this thing: accessed the add menu at the same time and we were given the same $Number. after inputting all fields, we submitted the form at the same time (but i believe the request did not get to the server at the same time bec. of some factors such as the network traffic). our $Number turned out to be unique afterwards. going over the code, there was a routine that checks the db_key first for uniqueness (and flocks) before finally saving it on the database. how can then i make sure that $DocNum gets the right $Number?
Quote Reply
Re: same ID In reply to
I see. Well, it's not too hard.

In the db.cgi script, sub add_record, after

my ($output, $status, $counter);

add

Code:
$in{'DocNum'} = "$in{'DocNum'}$in{'Number'}";

That will take whatever is in the DocNum field and stick the value of the Number field at the end of it.


------------------
JPD