Options

MULTIPLE CHOICE OPTION FIELD

ShonatinaShonatina Member Posts: 114
HI ALL

how can i select multiple option in my option fields...
like i have a option field post...n options are mail,letter,card,person
Now if i want to select both mail and letter what should i do?
normally we can only select 1 option right !

thank you :)
smile always
shona
That which you seek inside is that which you find outside
«1

Answers

  • Options
    vijay_gvijay_g Member Posts: 884
    First understand meaning of option Datatype.
    To fullfil requirment you have to go with another way.
  • Options
    Luc_VanDyckLuc_VanDyck Member, Moderator, Administrator Posts: 3,633
    You'll have to use several variables and display them as checkboxes. Then you can tick the ones which are applicable.
    No support using PM or e-mail - Please use this forum. BC TechDays 2024: 13 & 14 June 2024, Antwerp (Belgium)
  • Options
    BeliasBelias Member Posts: 2,998
    another good example to solve your problem (it all depends on what you need to do with the values) can be standard report 94, dimensions field (press assist button)
    -Mirko-
    "Never memorize what you can easily find in a book".....Or Mibuso
    My Blog
  • Options
    ShonatinaShonatina Member Posts: 114
    You'll have to use several variables and display them as checkboxes. Then you can tick the ones which are applicable.

    thanks for your reply luc, but thats not what i want...this field 'm refering to is already present in my table as option datatype....now my real requirement is to display this option field for different filters....like with 1 filter i need only mail and card....and with another filter i need mail and letter....like that.

    'm i making myself clear ?
    thank you
    smile always
    shona
    That which you seek inside is that which you find outside
  • Options
    ShonatinaShonatina Member Posts: 114
    vijay_g wrote:
    First understand meaning of option Datatype.
    To fullfil requirment you have to go with another way.

    vijay i do know the limits of an option field! and thats the field i need in my table....and if you can please provide me with the "another way"

    thanks
    smile always
    shona
    That which you seek inside is that which you find outside
  • Options
    ShonatinaShonatina Member Posts: 114
    Belias wrote:
    another good example to solve your problem (it all depends on what you need to do with the values) can be standard report 94, dimensions field (press assist button)

    hi belias :)
    can i know how this helps ? sorry :oops: i did go through the codes...and the assist button, but cant find anything that would help my situation :? ...maybe 'm missing something...just dont know what! #-o
    smile always
    shona
    That which you seek inside is that which you find outside
  • Options
    vijay_gvijay_g Member Posts: 884
    Shonatina wrote:
    vijay i do know the limits of an option field! and thats the field i need in my table....and if you can please provide me with the "another way"

    thanks

    if both above solutions are not sufficient to resolve ,then describe here what exactly you are doing and where user will put filter to see multiple option value and how u r showing multiple value in a single option field?

    r u doing it on form(only for display) ?
    and u r playing with code based on multiple value of this field?
  • Options
    BeliasBelias Member Posts: 2,998
    that assist butto provides a way to select different values from a table, and insert them in a single field.
    you will certainly need another field other than the option field you have in your table, if you want to select different values.
    You have to:
    0. try to filter some existing fields with values like *letter*|*telephone* before implementing the solution, i'm not sure it works as expected
    1. Delete your option field
    2. Create a new code field instead of the option field (let's call this mynewcodefield)
    3. create a table (only one field) and page/form bound to the table; insert the option values in this table
    4. write some code in the lookup trigger of mynewcodefield: you can get a hint from report 94 as stated before

    In this way you can select multiple values, and separate them with special characters like ";". don't use wildcards for separator, or you'll screw up the standard filter behaviour.

    your mynewcodefield will be populated with values like
    mail;letter
    letter;telephone

    and you'll be able to filter these values as explained in step 0
    -Mirko-
    "Never memorize what you can easily find in a book".....Or Mibuso
    My Blog
  • Options
    ShonatinaShonatina Member Posts: 114
    vijay_g wrote:
    if both above solutions are not sufficient to resolve ,then describe here what exactly you are doing and where user will put filter to see multiple option value and how u r showing multiple value in a single option field?

    r u doing it on form(only for display) ?
    and u r playing with code based on multiple value of this field?

    This is my requirement....i have a form called "EntryForm"...see attachment
    in this i have practise, method and resources....the Nav users can select only Nav details and so on..in the method and resources the user has a free rein...he/she can select any method and any resouces....

    see the attachment...you can see phases there...like diagnostic phase,analysis phase,design phase and we have 3 more phases...

    in methodology we have more options....Long term,Short term,ssp,tiny term,support term etc..
    so every methodology here has an set phases...like long term has all the phases...tiny has only 2 phases and so on...

    now i need to display only the phases that are concerned with the methodology...but the problem comes when this phase is an field in my table....so need to filter the fields...i tried using sourceviewtable and codes...but nothing helps...

    'm i clear or confusing till now?
    thanks
    scr.JPG 99.6K
    smile always
    shona
    That which you seek inside is that which you find outside
  • Options
    ShonatinaShonatina Member Posts: 114
    Belias wrote:
    that assist butto provides a way to select different values from a table, and insert them in a single field.
    you will certainly need another field other than the option field you have in your table, if you want to select different values.
    You have to:
    0. try to filter some existing fields with values like *letter*|*telephone* before implementing the solution, i'm not sure it works as expected
    1. Delete your option field
    2. Create a new code field instead of the option field (let's call this mynewcodefield)
    3. create a table (only one field) and page/form bound to the table; insert the option values in this table
    4. write some code in the lookup trigger of mynewcodefield: you can get a hint from report 94 as stated before

    In this way you can select multiple values, and separate them with special characters like ";". don't use wildcards for separator, or you'll screw up the standard filter behaviour.

    your mynewcodefield will be populated with values like
    mail;letter
    letter;telephone

    and you'll be able to filter these values as explained in step 0

    oh dear :shock: ...i think we are going in a wrong direction here :( .....i cant change any of my existing fields belias..its user specified :( . i have tried explaining what i want :roll: ...please see if it makes sense to you :)

    THANKS :)
    smile always
    shona
    That which you seek inside is that which you find outside
  • Options
    vijay_gvijay_g Member Posts: 884
    Shonatina wrote:
    now i need to display only the phases that are concerned with the methodology...but the problem comes when this phase is an field in my table....so need to filter the fields...i tried using sourceviewtable and codes...but nothing helps...
    thanks

    where you have linked to methodology with different-2 phases ,if not then how will system decide which one or more phases has linked with methodology?
  • Options
    ShonatinaShonatina Member Posts: 114
    vijay_g wrote:
    Shonatina wrote:
    now i need to display only the phases that are concerned with the methodology...but the problem comes when this phase is an field in my table....so need to filter the fields...i tried using sourceviewtable and codes...but nothing helps...
    thanks

    where you have linked to methodology with different-2 phases ,if not then how will system decide which one or more phases has linked with methodology?

    'm hardcoding the possiblities...so i have coded lik this


    IF (gDropDownPrac IN [ gDropDownPrac :: NAV]) THEN BEGIN
    IF (gdropdown IN [ gdropdown :: "Short Term"]) THEN BEGIN
    IF gIntest.GET("No.") THEN BEGIN
    gIntest.RESET;
    IF gIntest.FINDSET THEN BEGIN
    IF ("Phase Type" IN ["Phase Type"::"Diagnostic Phase","Phase Type"::"Analysis Phase"]) THEN BEGIN
    IF (gPm AND NOT gSe AND NOT gPl AND NOT gTechnical AND NOT gTeamLeader AND NOT gFunctional AND NOT gExternal AND NOT gDev
    )=TRUE THEN BEGIN
    gEntryFilter.ApplyMyFilter(gPm,gPl,gSe,gTeamLeader,gDev,gFunctional,gTechnical,gExternal);
    gEntryFilter.RUN;
    END;
    gIntest.MODIFY;
    END;
    END;
    END;
    END;
    END;

    the ones i have colored are the ones i have roughly coded! but not helping...so please correct.
    thanks
    smile always
    shona
    That which you seek inside is that which you find outside
  • Options
    sresre Member Posts: 62
    Quite interessting thread ... and I think you're current question doesn't have much to do with the initial question (selecting more than 1 option vs. limiting the number of options based on another field).

    If I got it right (still not sure) you're trying to limit the number of options in the methodology field based on what the user selected in the practice field. From my point of view that's not possible as there is no way to adapt the displayed options of a option field at runtime. In your code sample you apply filter to certain records but I guess that this won't have any effect on your two option fields.

    The only solution that comes to my mind would be to replace the option field methodology with a code field and relate that to a table in which you define the options. Then it would be able to define in the lookup function which methodologies should be displayed when the user hits F6 and that can be based on the practice option field.

    All that only applies IF I really understood your problem :-)

    Sascha
  • Options
    SavatageSavatage Member Posts: 7,142
    Shonatina wrote:
    HI ALL
    how can i select multiple option in my option fields...
    like i have a option field post...n options are mail,letter,card,person
    Now if i want to select both mail and letter what should i do?
    normally we can only select 1 option right !
    thank you :)

    As above he's right. You really should have written it out in some kind of flow chart 1st before trying to code it as you go.

    to answer your original question the only way I see you selecting multiple options using an option field is to make all the possible combinations - options!
    Mail
    Letter
    Card
    Person
    Mail & Letter
    Mail & Card
    Mail & Person
    Letter & Card
    Letter & Person
    Card & Person
    Mail & Letter & Card
    Mail & Letter & Person
    etc, etc.

    Then using a case statement or many IF'S you map out what you want to do when a specific selection is made.
  • Options
    ShonatinaShonatina Member Posts: 114
    sre wrote:
    Quite interessting thread ... All that only applies IF I really understood your problem :-)

    Sascha

    hi sascha...

    i really dont know how well to explain more...

    1st :

    i have a form with fields like the int.jgp image..

    Now if you see the field "Phase type" you can see what i meant by having only 2 or 3 types....there are 6 phases...and you can also see that this phase type is an field in the table/form....

    2nd:

    'm not going to change the multiple choice option of the Methodology only 1 methodolgy can be selected by 1 person....it works like this...A Nav person can access only Nav details in the Practise ...

    And in the methodology.....they can select again only 1 choice @ a time...its either long term,short term, tiny etc...but ONLY 1

    3rd..

    depending on what method they select we need to filter the phase accordingly...like for short term only devolopement and design phase is needed....so we show only that...and for tiny only analysis phase is needed so we show only that....CLEAR SO FAR?
    int.JPG 151.6K
    smile always
    shona
    That which you seek inside is that which you find outside
  • Options
    ShonatinaShonatina Member Posts: 114
    Savatage wrote:
    As above he's right.....
    Then using a case statement or many IF'S you map out what you want to do when a specific selection is made.

    hi harry...

    i have tried explaining my requirement above please see that...

    thanks :)
    smile always
    shona
    That which you seek inside is that which you find outside
  • Options
    BeliasBelias Member Posts: 2,998
    AFAIK, there's no way to exclude some option from being shown depending on some conditions.
    You can:
    1. use testfield to check if the phase is compliant with methodology (an error will pop up if the user selects a not allowed phase)

    2. change the fieldtype of phase from option to code, create a new table that contains all the possible phase-methodology combinations, and in the lookup of the phase, show to the user only the phases linked to the current methodology
    -Mirko-
    "Never memorize what you can easily find in a book".....Or Mibuso
    My Blog
  • Options
    sresre Member Posts: 62
    Shonatina wrote:
    i have a form with fields like the int.jgp image..
    OK, that's a different form than the one you used in the beginning. But we're still discussing how to reduce the number of options from which the user can select. It's not only about filtering the RECORDS in this overview, right?
    Shonatina wrote:
    depending on what method they select we need to filter the phase accordingly...like for short term only devolopement and design phase is needed....so we show only that...and for tiny only analysis phase is needed so we show only that....CLEAR SO FAR?

    That sounds like what I understood before as well. But still the problem is that you won't be able to reduce the number of options you show to the user in an option field. It's defined in the option string and can't be adapted by filters. That's why I had suggested to use e.g. a code field instead which relates to a table where you define the options (so some predefined records in a table instead of the option field). The user still could select ONLY ONE option but the adavantage is that you can filter the given options based on another field (so exactly what I understood you want to have). An additional advantage is that you don't have to adapt the table if you want to add an option (that's one reason why often use tables instead of option fields.

    Does that help? :-)

    Sascha
  • Options
    ShonatinaShonatina Member Posts: 114
    Belias wrote:
    2. change the fieldtype of phase from option to code, create a new table that contains all the possible phase-methodology combinations, and in the lookup of the phase, show to the user only the phases linked to the current methodology

    hmmmm thanks...i will try this....can you please tell me how exactly this works...what do you mean by create a table containing all possible combinations? please can you explain thanks again :)
    smile always
    shona
    That which you seek inside is that which you find outside
  • Options
    ShonatinaShonatina Member Posts: 114
    sre wrote:
    OK, that's a different form than the one you used in the beginning. But we're still discussing how to reduce the number of options from which the user can select. It's not only about filtering the RECORDS in this overview, right?

    i thought i will just pop an question with similar example...
    then when explaining got a bit difficult used the 1 'm working on..

    hmmm...the user will not filter....its like when they select "Tiny term"...only 1 phase type will be show always...that will be hardcoded...the question is how!?
    sre wrote:
    code field instead which relates to a table where you define the options (so some predefined records in a table instead of the option field). The user still could select ONLY ONE option but the adavantage is that you can filter the given options based on another field (so exactly what I understood you want to have). An additional advantage is that you don't have to adapt the table if you want to add an option (that's one reason why often use tables instead of option fields.

    Sascha

    please can you explain this technique a bit more...sorry but thanks :)
    smile always
    shona
    That which you seek inside is that which you find outside
  • Options
    kash387kash387 Member Posts: 111
    sre wrote:
    code field instead which relates to a table where you define the options (so some predefined records in a table instead of the option field). The user still could select ONLY ONE option but the adavantage is that you can filter the given options based on another field (so exactly what I understood you want to have). An additional advantage is that you don't have to adapt the table if you want to add an option (that's one reason why often use tables instead of option fields.

    Sascha

    please can you explain this technique a bit more...sorry but thanks :)[/quote]

    It means, create another table, where you will enter all the possible options/combinations in a code field.

    Now, go to your original table that you are using, go to phase field, change datatype to Code from Option, then go to the properties of Phase, go to the table relation, select the table you have created for the combinations. You can give conditions also based on your requirement.

    So, your field will be populated with the required combination and then you can use it for filtering.

    This is what I understand from Sascha's quote...!!!! If I am wrong, Kindly ignore the post.

    Thanks

    Kashyap
    Thanks,

    Kashyap
  • Options
    BeliasBelias Member Posts: 2,998
    sorry sre, the solution i've given is the same as yours, i've not seen your post #-o

    the explanation to the solution have been given by kash387
    -Mirko-
    "Never memorize what you can easily find in a book".....Or Mibuso
    My Blog
  • Options
    sresre Member Posts: 62
    At least Shonatina can't complain that no one cares about this post :-)))
    As I already had prepared my answer before I saw the post from kash387, I'll post it here anyway. Maybe the code exmample helps.
    Shonatina wrote:
    hmmm...the user will not filter....its like when they select "Tiny term"...only 1 phase type will be show always...that will be hardcoded...the question is how!?

    please can you explain this technique a bit more...sorry but thanks :)

    Sure, no problem. I'll use this example here as I guess I understand how that should work:
    Shonatina wrote:
    ...you can see phases there...like diagnostic phase,analysis phase,design phase and we have 3 more phases...
    in methodology we have more options....Long term,Short term,ssp,tiny term,support term etc..
    so every methodology here has an set phases...like long term has all the phases...tiny has only 2 phases and so on...

    The first thing would be to define a table which contains e.g. a field called Code which is the PK and a field called Description. Then create a form based on that table which you will need to display the options to the user. Furthermore you'll have to replace the option field Phase through a code field which has a table relation on the option table. Finally you would have to put some code in the OnLookup Trigger of your new field e.g. like that:
    recOptions.RESET;
    CASE Methodoloy OF
      'SHORT TERM':
        recOptions.SETFILER(Code, 'ANALYSIS|DESIGN');
      'TINY TERM':
        recOptions.SETFLTER(Code, 'DESIGN|IMPLEMENTATION')
    END;
    IF form.runmodal(frmOptions, recOptions) = Action::LookupOK THEN
      Phase := recOptions.Code;
    

    - recOptions is the table where you have all possible options
    - in the case statement you put the code which phases are allowed for which methodoloy
    - in form.runmodal you run the form whih is based on the option table and due to the filter only the options that make sense are shown to the user
    - finall when the user hits ok you have to take that code over to your basic record

    You would have to but something a bit similar in the OnValidate trigger to prevent users from directly typing phases in there which make no sense.

    By the way: we prefer to use numeric codes instead (as we have to translate our application in different languages it's not a good style to use language specific codes from my point of view.

    Good luck! :-)

    Sascha
  • Options
    ShonatinaShonatina Member Posts: 114
    kash387 wrote:

    please can you explain this technique a bit more...sorry but thanks :)

    It means, create another table, where you will enter all the possible options/combinations in a code field.

    Now, go to your original table that you are using, go to phase field, change datatype to Code from Option, then go to the properties of Phase, go to the table relation, select the table you have created for the combinations. You can give conditions also based on your requirement.

    So, your field will be populated with the required combination and then you can use it for filtering.

    This is what I understand from Sascha's quote...!!!! If I am wrong, Kindly ignore the post.

    Thanks

    Kashyap[/quote]

    thanks...
    smile always
    shona
    That which you seek inside is that which you find outside
  • Options
    BeliasBelias Member Posts: 2,998
    Shonatina wrote:
    kash387 wrote:

    please can you explain this technique a bit more...sorry but thanks :)

    It means, create another table, where you will enter all the possible options/combinations in a code field.

    Now, go to your original table that you are using, go to phase field, change datatype to Code from Option, then go to the properties of Phase, go to the table relation, select the table you have created for the combinations. You can give conditions also based on your requirement.

    So, your field will be populated with the required combination and then you can use it for filtering.

    This is what I understand from Sascha's quote...!!!! If I am wrong, Kindly ignore the post.

    Thanks

    Kashyap

    thanks...[/quote]
    Yes, this (option field + code field + table relation) is the simplest and most effective way :thumbsup:
    -Mirko-
    "Never memorize what you can easily find in a book".....Or Mibuso
    My Blog
  • Options
    ShonatinaShonatina Member Posts: 114
    kash387 wrote:

    It means, create another table, where you will enter all the possible options/combinations in a code field.

    Kashyap

    HOW DO I DO THIS...SORRY

    should i create an table like this

    FIELDS.......................................DATATYPE
    DESIGN/ANALYSIS........................CODE
    ANALYSIS/DIAGNOSTIC..................CODE

    THANKS :)
    smile always
    shona
    That which you seek inside is that which you find outside
  • Options
    BeliasBelias Member Posts: 2,998
    ](*,) sorry, but this is basic database design...the simplest way is to ask a more experienced developer, if there's one with you.
    I've no time to guide you step by step, but probably someone else have it (note that having someone guide you step by step is a good way to learn NAV).
    -Mirko-
    "Never memorize what you can easily find in a book".....Or Mibuso
    My Blog
  • Options
    kash387kash387 Member Posts: 111
    Shonatina wrote:

    HOW DO I DO THIS...SORRY

    should i create an table like this

    FIELDS.......................................DATATYPE
    DESIGN/ANALYSIS........................CODE
    ANALYSIS/DIAGNOSTIC..................CODE

    THANKS :)

    I dont know about your db and project, but let me clear few things that may help you....

    1) You want to put filter on Phase field, yes or no??
    If yes, create a table, Phase Combination Custom,
    create a field PhaseCombination Datatype Code,
    Value for that field is; the combination that you want to create for filter;
    so in this case Desing, Analysis and Diagnostic will be values of that fields.

    Go to the original table, use table relation property and apply some filters on the table relation based on your conditions.

    Or you can go for the lookup code also mentioned by Sascha, in both the case you also have to create a list type form for the newly created table.

    Kindly reply if this is not what you are asking...!!!???


    Thanks and Regards,

    Kashyap
    Thanks,

    Kashyap
  • Options
    ShonatinaShonatina Member Posts: 114
    kash387 wrote:

    I dont know about your db and project, but let me clear few things that may help you....

    1) You want to put filter on Phase field, yes or no??
    If yes, create a table, Phase Combination Custom,
    create a field PhaseCombination Datatype Code,
    Value for that field is; the combination that you want to create for filter;
    so in this case Desing, Analysis and Diagnostic will be values of that fields.

    Go to the original table, use table relation property and apply some filters on the table relation based on your conditions.

    Or you can go for the lookup code also mentioned by Sascha, in both the case you also have to create a list type form for the newly created table.

    Kindly reply if this is not what you are asking...!!!???


    Thanks and Regards,

    Kashyap

    hi kashyap...
    i have created an table called Phase Combination with a field Phasecombination....the values i have given as 1)design/analysis 2)Diagnostic Phase

    i have mapped this Phasecombination to my original table through the table relationship and also given lookup! and changed my Phase type in the original table as code...
    smile always
    shona
    That which you seek inside is that which you find outside
  • Options
    kash387kash387 Member Posts: 111
    So,
    what's your problem now???
    I mean whats that you still want and you are not getting???

    Thanks

    Kashyap
    Thanks,

    Kashyap
Sign In or Register to comment.