Hi All,
I added a field on the Item table which was of integer type and this field does not have any sort of table relation or any sort of triggers on it .
but after few days when few records were inserted up on the live database client changed his mind and wanted that field to be of decimal type.Now what is the best solution for it do ??
Many Thanks,
Tarun
0
Comments
I always such an operation do in that way:
1. Add a new Integer field. This field is empty (zero values) for all records.
2. Create a new report with the only DataItem set to table 27 (Item)
3. In this report section OnAfterGetRecord should be like this:
<new_added_integer_field> := <old_integer_field>;
<old_integer_field> := 0;
modify;
where:
<new_added_integer_field> - is a field you have just added
<old_integer_field> - is a field you want to swich from integer to decimal.
After this operation an old field has zero values for all records but you did not loose these values because they are copied into new field.
4. Now you can change type of field from integer to decimal.
5. In just created report change OnAfterGetRecord trigger:
<old_integer_field> := <new_added_integer_field>;
<new_added_integer_field> := 0;
modify;
Of course <old_integer_field> is Decimal, now.
6. Delete <new_added_integer_field> field from table
7. Delete the report.
And that is all.
Best Regards
Marcin Woch
_____________________
"ANTEI" Woch Marcin
email: marcinwoch@wp.pl
tel.: (+48608) 39 46 29
Poland
Thanks a lot . You are 100 percent correct .I should have thought about that . =D>
Many Thanks,
Tarun