Adding and removing items from a list
Hi
From the list myPersona I have to delete names that I find in the list myEsclusi and add names that I find in the list myAggiunti.
Can you please help me.
6 replies
-
And I need to sort the final list
-
i am hoping that myPersona is a dynamic choice field, otherwise what you are asking is would be very difficult in Ninox.
some more info about what kind of fields they are and the relevant table names would help as well
-
HI
myPersona is a list of people name coming from a people table.
Nominativo := Surname+ " " + Name;
let myPersona := (select Personale).Nominativo
Here an example of myPersona
"Scattini Stefano,Pedone Paola,Paladini Lucia,Martinelli Caterina,Scarafoni Manuel"
With the following code I can remove myEsclusi from myPersona. But I do not know how to add myAggiunti.
let myAzienda := Default;
let myElenco := [""];
let anyItem := [""];
let myQualifica := ID;
let myEsclusi := 'Elenco esclusi'.Personale.Nominativo;
let myPersona := unique(Ruoli.Ruoli.Organigramma.Personale);
myEsclusi := 'Elenco esclusi'.Personale.Nominativo;myElenco := sort(myPersona.Nominativo);
for anyItem in myElenco do
if not myEsclusi[= anyItem] then
["
"] + anyItem
end
end -
Since you have kept everything in arrays, very smart move, you can follow the ideas in this post to add modify arrays until you get to the group you need.
-
Hi Stefano,
following the post and ideas suggested by @fred and @jacques_tur, a code proposal could be as follows:let myPersona := (select Persone).(Cognome + " " + Nome); let myAggiunti := (select Aggiunti).(Cognome + " " + Nome); let myEsclusi := (select Esclusi).(Cognome + " " + Nome); " // Merge the two arrays with only unique values"; let newMergingArray := unique(array(myPersona, myAggiunti)); " // Get the array sorted, filtered and separated by a line break"; join(sort(newMergingArray[let me := this; not myEsclusi[= me]]), " ")
-
Thank you
Content aside
- Status Answered
- 2 yrs agoLast active
- 6Replies
- 244Views
-
4
Following