Skip to main content
July 19, 2024
Solved

custom check box issue

  • July 19, 2024
  • 4 replies
  • 0 views

hi, 

I have a custom check box written for my grid as i have nested loop , i a unable to implement the appian default selection check boxes. 

here is the code, 

a!richTextIcon(
icon: "square-o",
link: a!dynamicLink(
saveInto: {
a!save({local!selectedIndex},fv!index),

a!save(local!selectedProcedure, append(local!selectedProcedure,fv!item))
}
),
linkStyle: "STANDALONE",
showWhen: tointeger(local!selectedIndex) <> fv!index,
color: "SECONDARY",
size: "MEDIUM"
),
a!richTextIcon(
icon: "check-square-o-alt",
link: a!dynamicLink(
saveInto: {
a!save(local!selectedIndex,null),
a!save(local!selectedProcedure, difference(local!selectedProcedure,fv!item)),
}
linkStyle: "STANDALONE",
showWhen: tointeger(local!selectedIndex) = fv!index,
color:"SECONDARY",
size: "MEDIUM"
),

This code actually , appends the index in the local!selectionprocedure  but when i unselect it , it actually removes the last item in the local!selectedProcedure but not the actual index unselected. Any leads will help. 

    Best answer by raull0978

    Hi [mention:92ba06295fbc4d77b281c512999a858b:e9ed411860ed4f2ba0265705b8793d05] 
    Do you have anything inside fv!item that can be used as an identifier? if so you can try this:

    Change this

    a!save(local!selectedProcedure, difference(local!selectedProcedure,fv!item)),

    to this 

    a!save(local!selectedProcedure, remove(local!selectedProcedure,wherecontains(fv!item.id,local!selectedProcedure.id)),

    Here I am assuming that the unique element that can be used is called "id"

    Let me know if that helps!

    4 replies

    davidj137213
    Brainy
    July 19, 2024

    Why are you using difference instead of remove for removing the selected item?

    Having reviewed your code, it is adding the element to local!selectedProcedure when it is selected in the first structure, but you are using it in the second one... Perhaps the array local!selectedProcedure is not being handled correctly

    Could you share here the full code  here please?

    raull0978Answer
    July 20, 2024

    Hi [mention:92ba06295fbc4d77b281c512999a858b:e9ed411860ed4f2ba0265705b8793d05] 
    Do you have anything inside fv!item that can be used as an identifier? if so you can try this:

    Change this

    a!save(local!selectedProcedure, difference(local!selectedProcedure,fv!item)),

    to this 

    a!save(local!selectedProcedure, remove(local!selectedProcedure,wherecontains(fv!item.id,local!selectedProcedure.id)),

    Here I am assuming that the unique element that can be used is called "id"

    Let me know if that helps!

    July 20, 2024

    awesome , awesome, thanks for helping .it worked