Insert Option String

slmaluwaslmaluwa Member Posts: 358
hi
I have an Option field in few table to which I would like to insert another "Option". Eg:

Field: CreditCardType
Options: Master, Visa, American Express

Tables have records closer to a million. I need to insert another option like this:

Field: CreditCardType
Options: Master,JCB, Visa, American Express

Is there any easy way of inserting this? If just modify field, all previous "Visa" value will be displayed as "JCB".


TIA
"A bove maiore discit arare minor"-"From the old ox, the young one learns to plow."

Answers

  • ara3nara3n Member Posts: 9,255
    It is recommended to add options at the end of the fields.
    If that is not possible, then you have export all objects that reference the field as text, make the change and load all the text objects.

    Then write a routine to increment the option field if it's greater than 0 for all the records.
    Ahmed Rashed Amini
    Independent Consultant/Developer


    blog: https://dynamicsuser.net/nav/b/ara3n
  • slmaluwaslmaluwa Member Posts: 358
    Thanks for the reply Rashed,

    I decide to change it anyway and your solution of increasing the value by 1 for items >0 seem to be an excellent one for me.

    But, is it an absolute necessary to export/import objects as text? Or, an easuy way recommended to Search/Replace the text?

    I know the tables very well and can't I just go and change the table definition directly in Object Designer?

    Regards

    Maluwa
    "A bove maiore discit arare minor"-"From the old ox, the young one learns to plow."
  • ara3nara3n Member Posts: 9,255
    export just modified objects and import them.

    Otherwise all the code that refers to visa will now refer to JCB.

    If you want to make sure that it's ok to not do the change. Export the modified object as text and search for Creditcardtype.
    If you don't find it being used anywhere, are safe.
    Ahmed Rashed Amini
    Independent Consultant/Developer


    blog: https://dynamicsuser.net/nav/b/ara3n
  • slmaluwaslmaluwa Member Posts: 358
    Thanks again

    I understood the purpose of export/import in this case.

    Really appreciate your timely response
    "A bove maiore discit arare minor"-"From the old ox, the young one learns to plow."
  • ara3nara3n Member Posts: 9,255
    You are welcome.
    Ahmed Rashed Amini
    Independent Consultant/Developer


    blog: https://dynamicsuser.net/nav/b/ara3n
  • David_SingletonDavid_Singleton Member Posts: 5,479
    slmaluwa wrote:
    hi
    I have an Option field in few table to which I would like to insert another "Option". Eg:

    Field: CreditCardType
    Options: Master, Visa, American Express

    Tables have records closer to a million. I need to insert another option like this:

    Field: CreditCardType
    Options: Master,JCB, Visa, American Express

    Is there any easy way of inserting this? If just modify field, all previous "Visa" value will be displayed as "JCB".


    TIA

    The correct solution is to change the option to:
    Field: CreditCardType
    Options: Master, Visa, American Express,JCB

    You should never add an option in the middle of an existing string in a live system.
    David Singleton
  • ara3nara3n Member Posts: 9,255
    That was my first suggestion David. He didn't want to do it. Since this is his custom field it can be done. If it were a standard field, it should never be done.
    Ahmed Rashed Amini
    Independent Consultant/Developer


    blog: https://dynamicsuser.net/nav/b/ara3n
  • David_SingletonDavid_Singleton Member Posts: 5,479
    ara3n wrote:
    That was my first suggestion David. He didn't want to do it. Since this is his custom field it can be done. If it were a standard field, it should never be done.

    Yes I know you gave the right suggestion, its just a pity he didn't listen to you. :cry: At least you have helped him to minimize the damage, but wouldn't it be so much nicer if people just listen.
    David Singleton
  • ara3nara3n Member Posts: 9,255
    It's like most navision projects. I suggest a solution, and clients don't like it, and want it different way. I argue (which I don't online, it's inefficient) with clients and sometimes I win and some times I loose.
    In one argument, I even told the client that they can find another developer to do it, but most of the time you don't get that luxury.
    Ahmed Rashed Amini
    Independent Consultant/Developer


    blog: https://dynamicsuser.net/nav/b/ara3n
  • David_SingletonDavid_Singleton Member Posts: 5,479
    ara3n wrote:
    It's like most navision projects. I suggest a solution, and clients don't like it, and want it different way. I argue (which I don't online, it's inefficient) with clients and sometimes I win and some times I loose.
    In one argument, I even told the client that they can find another developer to do it, but most of the time you don't get that luxury.

    yes I know the feeling. And you are right, there is no point trying to convince someone on the forums to do things properly, when clearly they have already decided to go the wrong way, and are really just after a justification.

    No wonder some Navision projects go South.
    David Singleton
Sign In or Register to comment.