0

Could you help me, I need to connect two choise fields, one multiple choise oe and another Yes/No field. If let's say choise 5 and 8 are selected in the first one the other field will have to be Yes. Tried to do it with the trigger after update but I am not sure if it is correct '' if 'Payment Status' = 5 then 'Payment plan'.(DC := true) end''

Could you help me, I need to connect two choise fields, one multiple choise oe and another Yes/No field. If let's say choise 5 and 8 are selected in the first one the other field will have to be Yes. Tried to do it with the trigger after update but I am not sure if it is correct '' if 'Payment Status' = 5 then 'Payment plan'.(DC := true) end''

9 replies

null
    • Fred
    • 2 yrs ago
    • Reported - view

    Working with Multiple Choice fields is not staight forward as Choice fields. Once you select more than one choice then you can't use "=" anymore as you now have an array. For example if I have a MC field with three choices (Choice1,Choice2,Choice3). If I create another formula field with:

     

    text(MCfield)

     

    When I select Choice1, the formula field shows Choice1. If I select Choice1 and Choice2, the formula field shows Choice1,Choice2. And so on.

     

    If I change the formula field to:

     

    numbers(MCfield)

     

    Then following the same selection from above I would see 1. Then I would see 1,2 and so on.

     

    If I change the formula again to:

     

    number(MCfield) <- notice I dropped the "s" at the end

     

    Then I would see 1, then 3. This simple change now tells Ninox to show my only 1 number. Ninox assigns a value to each choice and adds them together. So if you don't have many choices you now can know the exact combo by just looking for the number returned. The first choice is given a value of 1. The second is given a value of 2, and the third choice is given the value of 4. You will have the following sums 1,2,3,4,5,6,7.

     

    Now you mentioned two single choice fields, a multiple choice field and a Yes/No field. But you don't mention if Payment Status is a MC or Choice. Can you post the code you are using?

    • Ninox partner
    • RoSoft_Steven.1
    • 2 yrs ago
    • Reported - view

    Fred, if I may add something...

    You can use the chosen() function to do this.

    For example if you want to check if the 5th and the 8th option is selected of a multiple choice field you can use this:

    if chosen('Multiple choice Field', [5, 8]) then Yes/No := true end

    Steven

    • billing
    • 2 yrs ago
    • Reported - view

    Thank you both! The chosen function is working lovely!

    • billing
    • 2 yrs ago
    • Reported - view

    Now if you want to end up to another multiple choise field you again have to use chosen function?

    • billing
    • 2 yrs ago
    • Reported - view

    Last question what if I have simple choise fields to connect? many thanks

    • Fred
    • 2 yrs ago
    • Reported - view

    You are correct about using chosen again if you have another multiple choice field to interrogate.

     

    You can search simple choice fields like you would think you would.

     

    if choicefield = 1 then

     

    or

     

    if text(chiocefield) = "TextA" then

    • billing
    • 2 yrs ago
    • Reported - view

    Tried to trigger after update one choise field to another with that coding but doesn't seem to work:

     

    if Active = 1 then
    'Client & Booked Course'.Client.'Private I Business' = 1
    else
    'Client & Booked Course'.Client.'Private I Business' = 2
    end

    • Ninox partner
    • RoSoft_Steven.1
    • 2 yrs ago
    • Reported - view

    Maybe this is the cause:

    '=' is used to check if something is equal. ':=' is used to modify data...
    So your formula would have to change to:

    if Active = 1 then
    'Client & Booked Course'.Client.'Private I Business' := 1
    else
    'Client & Booked Course'.Client.'Private I Business' := 2
    end

    Steven

    • billing
    • 2 yrs ago
    • Reported - view

    Yes that is the reason Steven thank you!

Content aside

  • 2 yrs agoLast active
  • 9Replies
  • 299Views