2
variable = List();
for each  r in input.Trainees_Present
{
variable.add(r.Intern_No);
}
input.Trainees_Absent = variable.tostring();
input.TraineeMul:ui.add(variable);`

//In this variables added in TraineeMul is which are selected in Trainees_Present

//I want that the variable to be added in TraineeMul which is not selected in Trainees_Present

ZohoCoder
  • 385
  • 5
  • 15

1 Answers1

1

I don't think that there is any default option to get unselected values from the choice fields or lookup fields.

I can give this as possible workaround for your usecase.

Case 1 - Lookup Field

I guess input.Trainees_Present is multi select look up field. So you are storing selected values r.Intern_No in list.

You can iterate overall values from backend form.

unselectedList = List();
for each trainee in Trainee_Form[<Give Criteria if you have any filter for lookup field>]
{
   if(variable.contains(trainee.Intern_No) == false)
   {
      unselectedList.add(trainee.Intern_No);
   }
}
input.TraineeMul:ui.add(unselectedList);

Case 2 - Choice Field - Solution 1

We have to store the choice fields in some other functions, we have to append all choices in OnLoad Script.

Since we have stored total list in one function, we can get unselected list by removing selected items from total list.

Case 2 - Choice Field - Solution 2

Zoho Creator provides as API to fetch form fields. We able to get the choices list from the response.

Link to the Documentation: https://www.zoho.com/creator/help/api/v2/get-fields.html

Vigneshkumar G
  • 328
  • 1
  • 2
  • 9