Is it possible in Navision Financials to do something like find and replace in excel with the first two characters from a code field.
For example:
KR/0004
has to become
PL/0004 when a condition is true.
Yes, it is doable through little programming. First, create a new temporary field and copy the value of the current field into it, you could write a routine to do this, they create another routine to
record.setrange(<Temporary field>,'KR/004');
if record.find('-') then begin
repeat
if record.<fieldname> = true then begin
record.<Original field> := 'PL/004';
record.modify;
end;
until record.next - 0;
end;
Thx for answering my question but I think I wasn't clear enough.
When a condition is true, I just want to chang the first two character of the field. The number has to be exactly the same.
It's not just one number I have to change, it can be all kinds of numbers.
Maybe I am missing something, but could you not filter your records on the 'condition' in some way and just use the standard Navision 'Find & Replace'?
I tried the following - I added a code field of 10 characters to the Customer table, and populated it with the word 'FROG'.
I then ran the table, did a CTRL + F to bring up the find tool, & pressed the 'Replace' button. In the 'Find What' field I put 'FR' and in 'Replace With' I put 'D' and hit 'Replace All'.
This changed all instances of FROG to DOG, leaving 'OG' unchanged.
Comments
Yes, it is doable through little programming. First, create a new temporary field and copy the value of the current field into it, you could write a routine to do this, they create another routine to
record.setrange(<Temporary field>,'KR/004');
if record.find('-') then begin
repeat
if record.<fieldname> = true then begin
record.<Original field> := 'PL/004';
record.modify;
end;
until record.next - 0;
end;
This should do what you are trying to do.
Regards
Suresh.
Thx for answering my question but I think I wasn't clear enough.
When a condition is true, I just want to chang the first two character of the field. The number has to be exactly the same.
It's not just one number I have to change, it can be all kinds of numbers.
thx
Maybe I am missing something, but could you not filter your records on the 'condition' in some way and just use the standard Navision 'Find & Replace'?
I tried the following - I added a code field of 10 characters to the Customer table, and populated it with the word 'FROG'.
I then ran the table, did a CTRL + F to bring up the find tool, & pressed the 'Replace' button. In the 'Find What' field I put 'FR' and in 'Replace With' I put 'D' and hit 'Replace All'.
This changed all instances of FROG to DOG, leaving 'OG' unchanged.
Sorry if I am missing something...
Lead Consultant
Theta