Have you ever had the need to replace some values from a list of values? For example, you need to change the Postal/Zip Code for a number of your customers. Most of the time you would need to write a codeunit or report to accomplish that or even have the customer update each entry by hand. What if you needed to do the same with your vendors? That would require either modifying the previous codeunit/report or possibly just creating a new object to handle this or again having the customer update each entry by hand.
Here is another option – a Replace page that you can add to any page with just a few lines of code.
Fig 1. Replace Page
Field Descriptions:
Options:
How to implement the page:
If you import the attached object text file and follow these steps you will be able to add this to almost any page (at least where it makes sense). For this example I will be updating the Customer List (Page 22).
1. Import and compile the attached object “Replace NAV2013.txt”.
2. Design the Customer Page (21).
3. Add a global variable named Replace and point it to Page 50050 (or whatever you may have changed it to prior to import)
4. Create a new action.
5. Go to the OnAction trigger for your new action and add the following code …
6. Compile your object and you should be ready to use it.
How it works:
Note: When use this Replace page, keep in mind that the TIME and DATETIME fields are very sensitive from a matching perspective. Even though the TIME may only appear to be HH:MM:SS on the page, there will probably be a millisecond component to the TIME as well. So, to have the best luck, it would probably be best to copy the value of the cell that you want to replace and use that as the value in “Find What” field. This is true with the DATETIME fields as well.
These postings are provided "AS IS" with no warranties and confer no rights. You assume all risk for your use.
Where is the attachment?
Of course, this could be a risky function, because it allows you to replace values in non-editable fields. It means, user could go around the Editable=No property and change values in such a field... just want to mention this...
How can null values be replaced?