Risks of changing optionstring?

JoshRingJoshRing Member Posts: 14
Hi,

I'm currently screening a customized database and have witnessed that a certain option-field has an incorrect order. The field (Status) consists of an optionstring with 13 elements, which all represent a certain phase. The phases are supposed to be chronological (option::one is the first phase, option::thirteen the last one).

The problem lies in phase 5 and phase 6. They are switched! So I have to make changes to a lot of status-fields and variables on forms and reports. I've checked the code: all option values are represented by their text values, not their numeric equivalents.

So, what's the best way to do this? Make a text export and global find/replace the wrong optionstrings with the correct one?

Thanks in advance,
JoshRing

Comments

  • DenSterDenSter Member Posts: 8,305
    If you do that, you will also have to address current data in the database. Everywhere else that this status is used, you will have to find all instances of those two values and switch them around. Internally those values are stored as integers, and if you switch the optionstring values around, the system will not switch the underlying integer values around.
  • kinekine Member Posts: 12,562
    A Denster wrote - the option values in objects are stored as Integer! It means, if you change the order of the optionstring, you will use wrong values in the code. There is one solution:

    1) export the objects into text.
    2) Change the Option String value (make a same change in the text file for the base table, where you are changing the option string)
    3) Import the text file back - the values will be matched through the text to correct integer representation and saved correctly.
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
Sign In or Register to comment.