on 06-27-2008 1:29 PM
i want to genearate one field in a table as auto generation.
how to make numbers in that.
I think one solution is creating a method where we are assigning values.
Context
Table(Node)
--No(attribute: type integer)
create a method and place the below code inside. you can set table serial number whenever you want by calling the same.
int size = wdContext.nodeTable().size();
for(int i = 0; i<size; i++) {
wdContext.nodeTable().getTableElementAt(i).setNo(i+1);
}
nikhil
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Create a calculated attribute of type int and bind this to the column
Ex:
public java.lang.Integer getID(IPrivateTestCompView.IContextElement element)
{
//@@begin getID
return element.index();
//@@end
}
Regards
Ayyapparaj
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Do you want these auto generated numbers to be in sequential order or random order?
In case of Sequential numbers, Write function which will increament global variable by 1 and return its value. This function will be called from addRow function.
In case of delete row, decreament value of these global variable.
Initialize global variable to 0 in begin others section.
Regards,
Apurva
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
If you need your auto generated number in a sequence use Nikil's code. or if you need that auto generated number as a random number.....
check if Math.random(); will be useful to you or not.
it generates a random number everytime. take that value and display in table field.
for example to make 5 digit auto generated random number...
*int five_digit = new Double( Math.random() * 100000 ).intValue();*
regards,
Pradeep
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
91 | |
10 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.