enum value through code

hi all,

i have added 1 more element in existing enum , now i want to shift the enum value by 1 position up .

for ex. my enum contain 3 elemente say e1,e2,e3 and i have added element e4 in it .

now my table contain a field say F having value e3 , i want to assign it value e4 ( existing + 1). for all record

pls suggest … its urgent…:frowning:

Take a look at the properties for each enum element, there you will find a property called “EnumValue”. Basically you can swap the enum values - put enumValue 4 for the element E3 and enumValue 3 for element E4. As you cannot assign the same number for two elements simultaneously, you will have to temporary put, let’s say, a value 99 for element E4, then set a value 4 to element E3 and then go back to element E4 and set it’s value to 3.

If you literally wanted just to swap E3 and E4, the best practice would be to create a small update job to run through all the records and change those values.

Or use the fill utility if possible in your application version

hi Janis,

i

am using following code

anytype enumval ;

int val;

While Select forupdate Source

{
ttsbegin;
enumval = 0;
val = 0;
enumval = Source.SARGlobeTrackAmount[1];
val = enum2int(enumval); // here i am getting the value of enum
Source.SARGlobeTrackAmount[1] = val + 1; // here i want to assign existing value + 1

ttscomit;

this is not working.

pls help

thanks

hi

for update a filed in every record in the table you can use this code :

while select forupdate Table_Name
{
Table_Name.number_code+=1; // u muse create table and a field for example number_code or other …
Table_Name.update();
}

************* this is certainly working *****************

jalal

hi

for update a filed in every record in the table you can use this code :

while select forupdate Table_Name
{
Table_Name.number_code+=1; // u muse create table and a field for example number_code or other …
Table_Name.update();
}

************* this is certainly working *****************

jalal