Retour sommaire : Direct Planning - Formules - Voir aussi : Syntaxe Visual Basic

Une étoile devant la teinte si elle est commune avec celle de la tâche précédente ; à la fin on indique le nombre de teintes communes.

' On va lister les couleurs et indiquer les couleurs communes avec la tache précédente
'---------------------------------------------------------------------------------------------
' Teintes de la tache courante
Dim Teinte1 as string = Tache.Information_Process(3).Zone_Configurable_1.trim()
Dim Teinte2 as string = Tache.Information_Process(3).Zone_Configurable_2.trim()
Dim Teinte3 as string = Tache.Information_Process(3).Zone_Configurable_3.trim()
Dim Teinte4 as string = Tache.Information_Process(3).Zone_Configurable_4.trim()
Dim Teinte5 as string = Tache.Information_Process(3).Zone_Configurable_5.trim()
Dim Teinte6 as string = Tache.Information_Process(3).Zone_Configurable_6.trim()

' Teintes de la tache précédente
Dim ListeTeintes_Prec as new System.Collections.Generic.List(of String)()
ListeTeintes_Prec.add(TachePrecedente.Information_Process(3).Zone_Configurable_1.trim())
ListeTeintes_Prec.add(TachePrecedente.Information_Process(3).Zone_Configurable_2.trim())
ListeTeintes_Prec.add(TachePrecedente.Information_Process(3).Zone_Configurable_3.trim())
ListeTeintes_Prec.add(TachePrecedente.Information_Process(3).Zone_Configurable_4.trim())
ListeTeintes_Prec.add(TachePrecedente.Information_Process(3).Zone_Configurable_5.trim())
ListeTeintes_Prec.add(TachePrecedente.Information_Process(3).Zone_Configurable_6.trim())

Dim NbCouleursCommunes as integer = 0

' Devant chaque teinte on met une étoile si elle est commune avec la tache précédente
'----------------------------------------------------------------------------------------
if Teinte1.Length > 0 andalso ListeTeintes_Prec.contains(Teinte1) then
    Teinte1 = "*" & Teinte1
    NbCouleursCommunes += 1
end if
if Teinte2.Length > 0 andalso ListeTeintes_Prec.contains(Teinte2) then
    Teinte2 = "*" & Teinte2
    NbCouleursCommunes += 1
end if
if Teinte3.Length > 0 andalso ListeTeintes_Prec.contains(Teinte3) then
    Teinte3 = "*" & Teinte3
    NbCouleursCommunes += 1
end if
if Teinte4.Length > 0 andalso ListeTeintes_Prec.contains(Teinte4) then
    Teinte4 = "*" & Teinte4
    NbCouleursCommunes += 1
end if
if Teinte5.Length > 0 andalso ListeTeintes_Prec.contains(Teinte5) then
    Teinte5 = "*" & Teinte5
    NbCouleursCommunes += 1
end if
if Teinte6.Length > 0 andalso ListeTeintes_Prec.contains(Teinte6) then
    Teinte6 = "*" & Teinte6
    NbCouleursCommunes += 1
end if

Libelle = libelle.trim() & " " & _
If(Teinte1.Length > 0, Teinte1 & ",","") & If(Teinte2.Length > 0, Teinte2 & ",","") & If(Teinte3.Length > 0, Teinte3 & ",","") & _
    If(Teinte4.Length > 0, Teinte4 & ",","") & If(Teinte5.Length > 0, Teinte5 & ",","") & If(Teinte6.Length > 0, Teinte6 & ",","")

if NbCouleursCommunes > 0 then
    Libelle = Libelle & " (" & NbCouleursCommunes & " en *commun)"
else
    Libelle = Libelle & " (aucune couleur commune)"
end if