• Solution for "Sender Address in views and folder"

    By Harald Osmann 2 decades ago

    Hi,



    I posted our solution 2 years ago already in the common OpenNTF Mail Experience project… perhaps it makes more sense for the german template?



    I think one of the most wanted features in european companies with Lotus Notes is showing the names in folders an views in a kind like "lastname, firstname". In a company with huge amount of users it makes no sense to sort them by firstname. We solved this problem (without lookup to the adressbokk) by making the simple assumption, that the lastname is the last word of the notes name and perhaps a prefix like "von", "van", "de", "du, …



    Here is the formula (works with Notes 4) we are using in our views for this job:



    SentBy := @If(Principal = ""; From; Principal);

    Who := @If(DeliveredDate != "" | SendTo = ""; SentBy; @Subset(SendTo; 1));

    CN1 := @Trim(@Name([CN]; Who));

    CN2 := @Left(@Right(Who;"/DDA:");"/" );

    CN := @If(@Contains(Who;"/DDA:");CN2;@Contains(@Right(Who;"@");">") & CN1="";@Trim(Who);CN1);

    G := @If(CN = ""; @Trim(@If(DeliveredDate != "" | SendTo = ""; @Name([G]; SentBy); @Name([G]; @Subset(SendTo; 1)))); "");

    S := @If(CN = ""; @Trim(@If(DeliveredDate != "" | SendTo = ""; @Name([S]; SentBy); @Name([S]; @Subset(SendTo; 1)))); "");

    Person := @If(CN != ""; CN; G != ""; G + " " + S; S != ""; S; @Trim(X400FreeForm));

    Person2 := @If(@Left(Person;1)="\"" & @Right(Person;1)="\""; @LeftBack(@RightBack(Person;1);1); Person);

    Person3 := @If(Form = "Delivery Report" : "NonDelivery Report" : "Trace Report"; "Mail Router"; Person2);

    REM "Some domains already use the reverse order…so prevent them to be resorted…";

    ReverseName := @If(@Contains(Who; "@Exchange":"@dummy.com"); "1"; "");



    REM "Split up the name into seperate words. Maximum of 6 words per name…";

    Wort1:= @Word(Person3; " "; 1) ;

    Wort2:= @Word(Person3; " "; 2) ;

    Wort3:= @Word(Person3; " "; 3) ;

    Wort4:= @Word(Person3; " "; 4) ;

    Wort5:= @Word(Person3; " "; 5) ;

    Wort6:= @Word(Person3; " "; 6) ;



    REM "Test for name prefixes like de, ter mac, von… which belong to the lastname";

    PräfixListe := "de":"del":"di":"du":"la":"le":"mc":"mac":"ter":"van":"von":"zur";

    Präfix1 := @If(@LowerCase(Wort1) = PräfixListe; "1"; "" );

    Präfix2 := @If(@LowerCase(Wort2)
    = PräfixListe; "1"; "" );

    Präfix3 := @If(@LowerCase(Wort3) = PräfixListe; "1"; "" );

    Präfix4 := @If(@LowerCase(Wort4)
    = PräfixListe; "1"; "" );

    Präfix5 := @If(@LowerCase(Wort5) *= PräfixListe; "1"; "" );



    REM "Take the number of words and the prefixes and build the reverse name like prefix + blank + last word + comma + blank + all other words from the beginning";

    @If(Person3 = "Mail Router"; Person3; ReverseName = "1" & Präfix1 = "1"; @Trim(Wort1 + " " + Wort2 + ", " + Wort3 + " " + Wort4 + " " + Wort5 + " " + Wort6); ReverseName = "1" & Präfix1 = ""; @Trim(Wort1 + ", " + Wort2 + " " + Wort3 + " " + Wort4 + " " + Wort5 + " " + Wort6); Wort6 != "" & Präfix5 != ""; Wort5 + " " + Wort6 + ", " + Wort1 + " " + Wort2 + " " + Wort3 + " " + Wort4; Wort6 != ""; Wort6 + ", " + Wort1 + " " + Wort2 + " " + Wort3 + " " + Wort4 + " " + Wort5; Wort5 != "" & Präfix4 != ""; Wort4 + " " + Wort5 + ", " + Wort1 + " " + Wort2 + " " + Wort3; Wort5 != ""; Wort5 + ", " + Wort1 + " " + Wort2 + " " + Wort3 + " " + Wort4; Wort4 != "" & Präfix3 != ""; Wort3 + " " + Wort4 + ", " + Wort1 + " " + Wort2; Wort4 != ""; Wort4 + ", " + Wort1 + " " + Wort2 + " " + Wort3; Wort3 != "" & Präfix2 != ""; Wort2 + " " + Wort3 + ", " + Wort1; Wort3 != ""; Wort3 + ", " + Wort1 + " " + Wort2; Wort2 != ""; Wort2 + ", " + Wort1; Person3)



    We are using this forula since 2 years and I think it works for internal mail in 99% of our more than 20.000 users. Perhaps someone is interested to implement this in OpenNTF Mail Experience?



    Regards, Harald

    • How do you want it?

      By Christian Tillmanns 2 decades ago

      Hi

      I tried Harald's formula and it is very good. Not perfect, but I will not be able to come up with a better solution. I think it is the best possible solution.

      Now, how you want me to implement it? I can write an agent that will change the column formula of a choice of existing views/folders (will take longer) or I just add one or two new views. Or I do the whole set of views and you can choose which one you want to use. Will not work on the inbox and folders.

      I tried it on the "person" view and that would be my solution, but you can tell, what you want.



      Nice work Harald. A really good solution IMHO. Thank you very much.

      Christian