Options

Different OptionString values per different Company

donitdonit Member Posts: 24
Hello,

I have an option data-type custom field in the Customer table. Would it be possible to have different OptionString values per different Company?

Thanks

Comments

  • Options
    kinekine Member Posts: 12,562
    It is not possible by design. OptionString is part of the object definition, and object definition is per database.

    Do not forget that in many cases, each value in option type have some "meaning" which is used in the C/AL code to make decissions, and if you will have different meaning per company, the code will need to know the correct meaning of each value in each company... this will be too much complicated.

    Better is to have additional table, where you can define different codes for different companies and you can have the option field in this table to give correct meaning to the code. It will make "mapping" between the user set code and the correct meaning of the option.

    (like table with fields "Code, Description, MyOption").
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • Options
    donitdonit Member Posts: 24
    Thank you, Kamil, for your explanation. There is a limit for adding tables this is why I researched this possibility.
  • Options
    FDickschatFDickschat Member Posts: 380
    Well, Kamils Solution is definitely the better one but this would also be possible:

    You could add Options to the field instead of replacing them
    Option 0 (for Company A)
    Option 1 (for Company B)
    Option 2 (for Company A+B)
    Option 3 (for Company C)
    Option 4 (for Company A)
    ...

    On Form or Page level create copies of the option control per Company and replace the Option String and Caption in these Controls to show only Options for these companies. Make the controls visible depending on the company in which the user currently works with Code in OnOpenForm, OnOpenPage. In Classic Client easy, in RTC a little more complex.

    For Company A the Option String would look like this:
    Option 0,,Option 2,,Option 4
    For Company B:
    ,Option 1,Option 2,,
    For Company C:
    ,,,Option 3,
    Frank Dickschat
    FD Consulting
Sign In or Register to comment.