Thanks for the response. I have a table which has three fields as primary key. In that i am trying to modify a field which is of integer data type. When i loop it and modify the first record it goes and saves in the table as last record hence the loop terminates abruptly. Can u give me a solution for this?
Thanks for ur replies,i have changed the primary key,but the system provides default message As do u want to change the primary key. Yes/No.. for each record Rather than providing YES for each key can i be able change as YES by default for only once which changes entire set of PK to be changed.
rec.setrang(fields);
re. findfirst then
repeat
rec1.get(rec);
rec1.renbame(fields);
unitl rec.next=0
like above
NEVER use FINDFIRST in a loop! you need to use the FINDSET-statement. But the idea is correct. The correct code to rename is this:
rec.RESET;
rec.SETCURRENTKEY(...);
rec.SETRANGE(...);
IF rec.FINDSET(TRUE,TRUE) THEN // check the help for info on the parameters of FINDSET
REPEAT
rec2 := rec;
rec2.RENAME(new key fields);
UNTIL rec.NEXT = 0;
Regards,Alain Krikilion No PM,please use the forum. || May the <SOLVED>-attribute be in your title!
Comments
Did you try with RENAME?
-Mohana
http://mohana-dynamicsnav.blogspot.in/
https://www.facebook.com/MohanaDynamicsNav
Regards
http://www.AcumenConsulting.co.nz
-Mohana
http://mohana-dynamicsnav.blogspot.in/
https://www.facebook.com/MohanaDynamicsNav
if you are not able to add a field then you can use any other field that is not being used in your table.
rec.setrang(fields);
re. findfirst then
repeat
rec1.get(rec);
rec1.renbame(fields);
unitl rec.next=0
like above
Ajageavi Nath Keshari
To get this to work you need to use another sorting key than the Primary Key. It is also good practice to use another variable to do the changes in.
E.g. like this
Regards
http://www.AcumenConsulting.co.nz
Any soultions ..
-Mohana
http://mohana-dynamicsnav.blogspot.in/
https://www.facebook.com/MohanaDynamicsNav
No PM,please use the forum. || May the <SOLVED>-attribute be in your title!