0

A question about Choice and Multiple choice

How to select or unselect all options in a Multiple choice by code in bulk? How to select or deselect options in a Choice by code? I want to use it in "Trigger after update", how should the code be written? Thank you for your reply.

15 replies

null
    • gold_cat
    • 5 mths ago
    • Reported - view

    I have selected "sales". I want all the options below it to be selected as well.

    • Fred
    • 5 mths ago
    • Reported - view

    To unselect a dynamic field you can do:

    dynamicfield := 0

    For the other question you have to use a button. See the attached DB.

      • gold_cat
      • 5 mths ago
      • Reported - view

       You are right to fred, I always forget to join ':' thanks.   

      • Rafael Sanchis
      • Rafael_Sanchis
      • 5 mths ago
      • Reported - view

       Hi Fred one Question.

      What happen if one Staff work for 2 o 3 company. The Staff is a Freelance and work for more than a one compay.

      Thanks

      • Rafael Sanchis
      • Rafael_Sanchis
      • 5 mths ago
      • Reported - view

       I modify I place only two Staff (Rafael to Scheduler & Gabriela to Marketing)

      But show both on the same Departament 😮  I'm doing something bad.

      • Fred
      • 5 mths ago
      • Reported - view

      what is your code?

      • Rafael Sanchis
      • Rafael_Sanchis
      • 5 mths ago
      • Reported - view

      FredYour code the same 

      In your example Audry is on different company 

      • Fred
      • 5 mths ago
      • Reported - view

      The DB is setup to only have 1 company per staff. Did you create a new dynamic multichoice field? or did you add another reference field to company?

      • Rafael Sanchis
      • Rafael_Sanchis
      • 5 mths ago
      • Reported - view

       In your example Audrey is in R&D and Marketing

      • Fred
      • 5 mths ago
      • Reported - view

      The code for the Staff field in Check looks for any records in Staff that have 1 of the choices selected in company. Audrey is related to Marketing only. In your first picture Marketing is selected so Audrey will show up. If you unselect Marketing Audrey will disappear.

      • Rafael Sanchis
      • Rafael_Sanchis
      • 5 mths ago
      • Reported - view

      Fred Audery appear in Marketing too if you select Marketing

      And sorry Fred maybe is a Bug on Android.

      • Fred
      • 5 mths ago
      • Reported - view

      You are correct. Using text() caused an incorrect valuation. Marketing is 1 and R&D is 10, so 1 is in 10 so anyone in Marketing shows up in R&D.

      The correct way to do this is:

      let xx := numbers(company);
      select Staff where contains(xx, number(company))
      

      It is confusing to read, but line 1 gets the value of the dmc field company in the Check table. While line 2 gets the value of the reference field company in the Staff table.

      • Rafael Sanchis
      • Rafael_Sanchis
      • 5 mths ago
      • Reported - view

      fredoThanks Fred resolved 👍

      I return to my first question, what would it be if I had an employee in several companies. Is possible in some companys there are some company that have internal some others company and some employee work on several companys

      • Fred
      • 5 mths ago
      • Reported - view

      Take a look at the code for the newDMC field. You also have to have a multiple choice field in staff.

      • Rafael Sanchis
      • Rafael_Sanchis
      • 5 mths ago
      • Reported - view

      Excelent Fred. thanks.

Content aside

  • Status Answered
  • 5 mths agoLast active
  • 15Replies
  • 105Views
  • 3 Following