0

Determine Multiple Choice baed on other field

Hi would like to set the value of a multiple-choice based on the value of another field, I have tried:

if EU = 1 then

EVG Sales Regions =: classification("Europe").

My problem is further if there are multiple selections such as USA = 1 and China - 1 how do I set each field to select on multiple choice?

See attached inputScreen Shot 2019-04-22 at 4.55.04 PM fields

Thanks

5 replies

null
    • Sean
    • 5 yrs ago
    • Reported - view

    You can use something like this...

     

    'EVG Sales Regions' := unique(numbers('EVG Sales Regions'), 1)

    for Europe

    'EVG Sales Regions' := unique(numbers('EVG Sales Regions'), 2)

    for UK, etc

     

    You could implement a it couple of different ways. I would enter it in "Trigger after update" for each of the Number fields like...

     

    if EU = 1 then

    'EVG Sales Regions' := unique(numbers('EVG Sales Regions'), 1)

    End

    • Sean
    • 5 yrs ago
    • Reported - view

    "End" should be "end"

    • wynand
    • 5 yrs ago
    • Reported - view

    Thanks Sean, the formula works. My challenge lies with existing data since Ninox triggers don't execute for existing data unless I go back and change each field by hand

    • Sean
    • 5 yrs ago
    • Reported - view

    wynand, You can attach this code to a button and it will update existing records...

     

    for r in select YourTable do
    if r.EU = 1 then
    r.('EVG Sales Regions' := unique(numbers(r.'EVG Sales Regions'), 1))
    end;
    if r.UK = 1 then
    r.('EVG Sales Regions' := unique(numbers(r.'EVG Sales Regions'), 2))
    end;
    if r.US = 1 then
    r.('EVG Sales Regions' := unique(numbers(r.'EVG Sales Regions'), 3))
    end;
    if r.China = 1 then
    r.('EVG Sales Regions' := unique(numbers(r.'EVG Sales Regions'), 4))
    end
    end

    • wynand
    • 5 yrs ago
    • Reported - view

    Works perfectly thanks

Content aside

  • 5 yrs agoLast active
  • 5Replies
  • 1487Views