It seems that whenever I tell a Lotus Notes programmer about this site, their reaction is consistently, "you must have a lot of Lotus Notes code posted !" Of course, this is not to say that Lotus Notes is a bad language (I've never used it), but it is odd that I keep hearing this. No less, Drew Refshauge does a bit of Lotus Notes and was called in to a client to fix a strange bug: some lists stopped working after it had twenty items. Right away, Drew knew what was wrong: while most would simply put the name of a list field in a drop-down box to get its values ("=exp_newlocation"), the original coder figured that breaking the list apart and assembling it again was the way to go ...

= @If(
    @Elements(exp_newlocation) = 1;
      @Subset(@Subset(exp_newlocation;1);-1);

    @Elements(exp_newlocation) = 2;
      @Subset(@Subset(exp_newlocation;1);-1)
        :@Subset(@Subset(exp_newlocation;2);-1);

    @Elements(exp_newlocation) = 3;
      @Subset(@Subset(exp_newlocation;1);-1)
        :@Subset(@Subset(exp_newlocation;2);-1)
        :@Subset(@Subset(exp_newlocation;3);-1);

    @Elements(exp_newlocation) = 4;
      @Subset(@Subset(exp_newlocation;1);-1)
        :@Subset(@Subset(exp_newlocation;2);-1)
        :@Subset(@Subset(exp_newlocation;3);-1)
        :@Subset(@Subset(exp_newlocation;4);-1);

    ...

    @Elements(exp_newlocation) = 19;
      @Subset(@Subset(exp_newlocation;1);-1)
        :@Subset(@Subset(exp_newlocation;2);-1)
        :@Subset(@Subset(exp_newlocation;3);-1)
        :@Subset(@Subset(exp_newlocation;4);-1)
        :@Subset(@Subset(exp_newlocation;5);-1)
        :@Subset(@Subset(exp_newlocation;6);-1)
        :@Subset(@Subset(exp_newlocation;7);-1)
        :@Subset(@Subset(exp_newlocation;8);-1)
        :@Subset(@Subset(exp_newlocation;9);-1)
        :@Subset(@Subset(exp_newlocation;10);-1)
        :@Subset(@Subset(exp_newlocation;11);-1)
        :@Subset(@Subset(exp_newlocation;12);-1)
        :@Subset(@Subset(exp_newlocation;13);-1)
        :@Subset(@Subset(exp_newlocation;14);-1)
        :@Subset(@Subset(exp_newlocation;15);-1)
        :@Subset(@Subset(exp_newlocation;16);-1)
        :@Subset(@Subset(exp_newlocation;17);-1)
        :@Subset(@Subset(exp_newlocation;18);-1)
        :@Subset(@Subset(exp_newlocation;19);-1);

    @Elements(exp_newlocation) = 20;
      @Subset(@Subset(exp_newlocation;1);-1)
        :@Subset(@Subset(exp_newlocation;2);-1)
        :@Subset(@Subset(exp_newlocation;3);-1)
        :@Subset(@Subset(exp_newlocation;4);-1)
        :@Subset(@Subset(exp_newlocation;5);-1)
        :@Subset(@Subset(exp_newlocation;6);-1)
        :@Subset(@Subset(exp_newlocation;7);-1)
        :@Subset(@Subset(exp_newlocation;8);-1)
        :@Subset(@Subset(exp_newlocation;9);-1)
        :@Subset(@Subset(exp_newlocation;10);-1)
        :@Subset(@Subset(exp_newlocation;11);-1)
        :@Subset(@Subset(exp_newlocation;12);-1)
        :@Subset(@Subset(exp_newlocation;13);-1)
        :@Subset(@Subset(exp_newlocation;14);-1)
        :@Subset(@Subset(exp_newlocation;15);-1)
        :@Subset(@Subset(exp_newlocation;16);-1)
        :@Subset(@Subset(exp_newlocation;17);-1)
        :@Subset(@Subset(exp_newlocation;18);-1)
        :@Subset(@Subset(exp_newlocation;19);-1)
        :@Subset(@Subset(exp_newlocation;20);-1);
    "")

 

Lotus Cheatsheet:

  • ":" is list concatenation operator 
  • @Subset(@Subset(some_list;N);-1); is like as "some_array[N]"
  •   @If(a,b,c,d,e) is pretty much "if (a) return b; else if (c) return d; else return e"
[Advertisement] BuildMaster allows you to create a self-service release management platform that allows different teams to manage their applications. Explore how!