Tip

Show multiple Lotus Notes document fields in a single view column

VIEW MEMBER FEEDACK TO THIS TIP
You can use multiple Lotus Notes document fields in a single column to show data by using the @explode command with Formula language.

For example, let's say you have a budget table that you want to see in a Lotus Notes view. Just follow these steps:

More Lotus Formula language resources from SearchDomino.com:
Lotus Formula language coding primer

An introduction to Formula language for Lotus Notes -- 7 tips in 7 minutes

Formula language advice

Looping through @implode and @explode

Using @explode in an agent

Formula Language Reference Center

  1. Create a Lotus Notes form and add a number field where you'll be able to write your budget year.

  2. Then, create a table with two columns and 12 rows. The first column has 12 computed fields (representing the months January through December). The second column has 12 editable number fields for your monthly budgets.
  3. Create a computed multi-value field that checks which rows will be shown in the Lotus Notes view.

    Name your field "Rows" and use the following Formula language code:

    @Trim(
    @If( @IsNumber(BudgetAmount_1) ;"01";""):
    @If( @IsNumber(BudgetAmount_2) ;"02";""):
    @If( @IsNumber(BudgetAmount_3) ;"03";""):
    @If( @IsNumber(BudgetAmount_4) ;"04";""):
    @If( @IsNumber(BudgetAmount_5) ;"05";""):
    @If( @IsNumber(BudgetAmount_6);"06";""):
    @If( @IsNumber(BudgetAmount_7);"07";""):
    @If( @IsNumber(BudgetAmount_8);"08";""):
    @If( @IsNumber(BudgetAmount_9) ;"09";""):
    @If( @IsNumber(BudgetAmount_10) ;"10";""):
    @If( @IsNumber(BudgetAmount_11) ;"11";""):
    @If( @IsNumber(BudgetAmount_12) ;"12";"")
    )
    
  4. Create a hidden field for both columns -- budget and month.

    Note: Make sure that both text fields and multiple values are allowed. You should also create a field for "Years."

    Here is the formula for "BudgetMonths":

    @Trim(
    @If(@Contains(Rows;"01"); "01. January";""):
    @If(@Contains(Rows;"02");"02. February";""):
    @If(@Contains(Rows;"03");"03. March";""):
    @If(@Contains(Rows;"04");"04. April";""):
    @If(@Contains(Rows;"05");"05. May";""):
    @If(@Contains(Rows;"06");"06. June";""):
    @If(@Contains(Rows;"07");"07. July" ;""):
    @If(@Contains(Rows;"08");"08. August";""):
    @If(@Contains(Rows;"09");"09. September" ;""):
    @If(@Contains(Rows;"10");"10. October";""):
    @If(@Contains(Rows;"11");"11. November";""):
    @If(@Contains(Rows;"12");"12. December" ;"")
    )
    

    Here is the formula for "BudgetAmounts":

    @Trim(
    @If(@Contains(Rows;"01"); @Text(BudgetAmount_1);""):
    @If(@Contains(Rows;"02");@Text(BudgetAmount_2);""):
    @If(@Contains(Rows;"03");@Text(BudgetAmount_3);""):
    @If(@Contains(Rows;"04");@Text(BudgetAmount_4);""):
    @If(@Contains(Rows;"05");@Text(BudgetAmount_5);""):
    @If(@Contains(Rows;"06");@Text(BudgetAmount_6);""):
    @If(@Contains(Rows;"07");@Text(BudgetAmount_7) ;""):
    @If(@Contains(Rows;"08");@Text(BudgetAmount_8);""):
    @If(@Contains(Rows;"09");@Text(BudgetAmount_9) ;""):
    @If(@Contains(Rows;"10");@Text(BudgetAmount_10);""):
    @If(@Contains(Rows;"11");@Text(BudgetAmount_11);""):
    @If(@Contains(Rows;"12");@Text(BudgetAmount_12) ;"")
    )
    

    Here is the formula for "Years":

    y:=@Text(Year);
    @Trim(
    @If(@Contains(Rows;"01");y;""):
    @If(@Contains(Rows;"02");y;""):
    @If(@Contains(Rows;"03");y;""):
    @If(@Contains(Rows;"04");y;""):
    @If(@Contains(Rows;"05");y;""):
    @If(@Contains(Rows;"06");y;""):
    @If(@Contains(Rows;"07");y ;""):
    @If(@Contains(Rows;"08");y;""):
    @If(@Contains(Rows;"09");y ;""):
    @If(@Contains(Rows;"10");y;""):
    @If(@Contains(Rows;"11");y;""):
    @If(@Contains(Rows;"12");y ;"")
    )
    
  5. Create a Lotus Notes view with three columns. The first column shows the year.

    Check off "Show multiple values as separate entry" and use the following formula for the column:

    @TextToNumber(@Explode(Years;""))
    

    The second column shows the month.

    Check off "Show multiple values as separate entry" and use following formula for the column:

    @Explode(BudgetMonth;"")
    

    The second column shows the budget.

    Check off "Show multiple values as separate entry" and use the following formula for the column:

    @TextToNumber(@Explode(BudgetAmounts;""))
    
  6. Now, fill in the budget form.

Note: You can use the totals, averages, etc. properties like you would normally.

MEMBER FEEDBACK TO THIS TIP

This tip explains that it is for a Lotus Notes view, but a Lotus Notes view can only show nine rows from a single record in a column. This would work well on a Web-enabled system, which does not have the nine-row limitation.
—Gregg B.

Thanks for posting a comment Gregg. This trick actually does work in the Lotus Notes client side. I've tested and used this trick in a Lotus Notes Domino production environment for six months. Even now, there is one Lotus Notes document that has 24 rows, all of which are correct.
—Olli-Pekka Kamarainen, tip author

Do you have comments on this tip? Let us know.

This tip was submitted to the SearchDomino.com tip library by member Olli-Pekka Kamarainen. Please let others know how useful it is via the rating scale below. Do you have a useful Lotus Notes, Domino, Workplace or WebSphere tip or code snippet to share? Submit it to our monthly tip contest and you could win a prize.

This was first published in September 2007

Disclaimer: Our Tips Exchange is a forum for you to share technical advice and expertise with your peers and to learn from other enterprise IT professionals. TechTarget provides the infrastructure to facilitate this sharing of information. However, we cannot guarantee the accuracy or validity of the material submitted. You agree that your use of the Ask The Expert services and your reliance on any questions, answers, information or other materials received through this Web site is at your own risk.