Join without empty lines
Hi all,
I have a few fields (yes/no) to list all the papers that i might receive from people when they sign a contract. Let's say it's a list of ten different documents.
Some people deliver them all, others just a few of them.
I want to list those papers without having "empty lines" in the list. I used the join function in a formula field, but i get empty lines.
This is the formula i used:
let xDocId := if 'Doc_Identità' = 1 then
"- Documento di riconoscimento (" + 'Tipo_Identità' + " n. " + 'NUMERO_Identità' + ") rilasciato da: " + 'RILASCIO_Identità' + " il giorno " + 'DATA_Identità' + " e valevole fino al giorno " + 'SCADENZA_Identità'
else
null
end;
let xCodFisc := if Doc_CodiceFiscale = 1 then
"- Copia del Codice Fiscale"
else
null
end;
let xAutocer := if Doc_Autocertificazione = 1 then
"- Dichiarazione sostitutiva di certificazione"
else
null
end;
let xCasellario := if Doc_Casellario = 1 then
"- Certificato penale del casellario giudiziale (art. 2 D.Lgs n. 39/2014)"
else
null
end;
let xCarichi := if Doc_CarichiPendenti = 1 then
"- Certificato dei carichi pendenti"
else
null
end;
let xTitolo := if Doc_Titolo = 1 then
"- Titolo di studio: " + Tipo_Titolo
else
null
end;
let xSogg := if Doc_Soggiorno = 1 then
"- Permesso di Soggiorno"
else
null
end;
let xResidenza := if Doc_Residenza = 1 then
"- Certificato di residenza"
else
null
end;
let xFam := if Doc_Famiglia = 1 then
"- Certificato di stato di famiglia"
else
null
end;
let xNucleo := if Doc_Nucleo = 1 then
"- Documentazione richiesta dalle leggi vigenti per assegni per nucleo famigliare"
else
null
end;
join([xDocId, xCodFisc, xAutocer, xCasellario, xCarichi, xTitolo, xSogg, xResidenza, xFam, xNucleo], "
")
and this is the result i get when i select just a few of them
Is there a way to achieve what i want?
10 replies
-
No need of the else then null, also not using the join function is easier.
Steven
-
Thank you so much RoSoft_Steven
seems like I’m good at making hard task out of easy things
-
Hi Gianluca
A different take would be
let a := ["One", "Two", "Three"]; let b := ['Yes / No', 'Yes / No 2', 'Yes / No 3']; let c := ["x"]; let i := 0; for d in b do if d then c := array(c, [item(a, i)]) end; i := i + 1 end; c := slice(c, 1, count(a) + 1); join(c, " ")
Where a is an array of all your lines of text and b is an array of all your yes/no fields.
Regards John
-
Hi,
I find myself in a similar situation. When I want to display different texts in a formula while separating each type of text with a "-", I use the join() function
The problem is that when I have empty fields, the join() function still adds the "-" which gives me several "-" in a row while I don't want to have any when an info is empty .
Formula :
let RappelImportant := if 'Rappel important' then 'Rappel important' end; let ActiviteAconfirmer := if 'Activités à confirmer' then "RDV à confirmer" end; let ContratAsigner := if 'Contrats à signer' then "Contrat à signer" end; let CarteCadeauAenvoyer := if 'Carte cadeau de fidélité à envoyer' = true then "Nouveau palier de fidélité" end; let CarteParrainAenvoyer := if 'Carte cadeau de parrainage à envoyer' = true then "Nouveau palier de parrainage" end; let PHV := if 'Envoyer plan d’hygiène vitale' = true then "Envoyer plan d'hygiène vitale" end; join([RappelImportant, ActiviteAconfirmer, ContratAsigner, CarteCadeauAenvoyer, CarteParrainAenvoyer, PHV], " - ")
Result :
Test - - - - Nouveau palier de parrainage - Envoyer plan d'hygiène vitale
In this example, lines 2, 5 and 6 give no text to display. The "-" are still added which poses a problem for me to read the result.
Is it possible to do something to avoid the extra "-"?
Content aside
- 1 yr agoLast active
- 10Replies
- 157Views
-
5
Following