Number of documents in a view? Please, i need help!

Hi, my name is Alex and I am desperate with the problem I have… I´m usign Lotus Designer for develop a web application.

I have to show de HTML code of a menu that previously I have saved with a form. Every menu element document have the fields Menu_Index, Menu_Name, Submenu_Index, Submenu_Name. I must to show the code from this menu so that he remains constructed well in list style of the following way:

  • *Menu_Name 1

      **

    • Submenu_Name 1.1
    • Submenu_Name 1.2
    • Submenu_Name 1.3

  • *Menu_Name 2

      **

    • Submenu_Name 2.1
    • Submenu_Name 2.2

The view I have constructed has four columns: two of them for ordering elements (Menu_Index and Submenu_Index) and the other ones for showing information. The problem is that when I show the last submenu from a determined menu, I have to add the closing labels for the lists * and **, but I don´t know how to obtain it. I am novice with Formula Language and @functions. I have checked all of them but there is no way…

Does somebody know how to fix it ? Is it possible to create global variables in a view for using it as control?

I would be very grateful if you could help me. Thank you in advance.

PS: I had thought about adding a field in the menu elements form, but I have said that forms can´t be modified :frowning:

Subject: Number of documents in a view? Please, i need help!

Hi Ale.First at all, sorry for my english…

I supposed that your using a Viewtemplate or Searchtemplate to show the view.

Then you cand do something like that, in the viewtemplate:

  • -------VIEWBODY-------

Then in your colum just add at the beginin of the code. This will generate a empty li at then top of the view, but it don’t have to be a problem.

I hope that this help you.

Subject: Number of documents in a view? Please, i need help!

Alex, it is not clear to me what you need to accomplish.

Do you need to generate HTML code? In the format of a list with the given list-tags?

Do you have sample code?

I am happy to help you, but it need to know what you want to do. And since I suspect, you are not very familiair with programming in Notes, you better explain you desired result and not so much an approach that could become a dead-end.

Subject: RE: Number of documents in a view? Please, i need help!

Hi Alex,I had to do the same recently, the easiest way I found to do it was to use LotusScript in the webqueryOpen event and populate a field with the correctly rendered HTML:

Dim view As NotesView

Dim viewNav As NotesViewNavigator

Dim viewEntry As notesviewentry



Set view=thisDB.GetView("menu")

Set viewNav = view.CreateViewNav

Set viewEntry = viewNav.GetFirstDocument



'Note it may be quicker / less resource used to use a literal string and one appendText() rather than several.



Call menurti.AppendText("<ul>")



While Not (viewEntry Is Nothing)

	If (viewEntry.ColumnValues(0) = "main_menu") Then

		Call menurti.AppendText({<li><a href="} + viewEntry.ColumnValues(4) + {"> } + viewEntry.ColumnValues(2) + {</a></li>})

		'level1menu is used for the page_foot and should not include sub_menu#

		level1menu = level1menu +{<li><a href="} + viewEntry.ColumnValues(4) + {"> } + viewEntry.ColumnValues(2) + {</a></li> }

		'trailing space in footer links is important. in main menu link sit is not important.

		

		If (<sub menu req'd for this section>) Then

			Call subroutine to generate sub menu in the same way as this menu. Cycle through them and pull the appropriate information.		

		End If

	End If

	

	Set viewEntry = viewNav.GetNextDocument(viewEntry)

Wend



Call menurti.AppendText("</ul>")

This code cycles through the view that contains the menu elements, in my case I have them ordered and split by menu (main_menu) and sub menu (sub_menu), and the column values relate to the column number in the view “menu” (“0”-> column 1, “1”-> column 2, etc.)

I hope this helps.

Thanks,

Brian

Subject: RE: Number of documents in a view? Please, i need help!

Hi Rob and Brian, thanks for responding :slight_smile:

Rob: Basically, I need to write HTML code, in order to show it in a browser. The problem is that I need to open and close the tags correctly, so I need to know when I am writing the last submenu from a determinate menu to close its list tags.

Brian: Thanks… but I have no idea of LotusScript. I met Lotus Notes / Designer two weeks ago. I still have many things for learning. Formula Language is more familiar for me.

Anyhow, I got something… In column I show the Menu name, I have written:

@If(@DocDescendants!=0 & Menu_Index=“01”;

…“

  • ”+Menu_Name+“
      ”;

      …“

  • ”+Menu_Name+“
      ”)

      And it works!!! But that solution is not too flexible. If somebody creates his menu starting at index 02, 03… it doesn´t work. I have been trying with the formula @DocNumber, that orders the documents starting at 1, 1.1, 1.2… etc. I am only intested in indexes 1, 2, 3… so I thougth that a simply comparision in an @If would be enough… But not. @DocNumber returns a Special Text, and I have not found the way to use it.

      Is there no way to compare the value returned by @DocNumber? Is there another one way to simulate this?

      Thanks you very much :slight_smile:

  • Subject: RE: Number of documents in a view? Please, i need help!

    Nobody? :frowning: