Sidrah
Sidrah

Reputation: 77

How to get a sequential number of all the documents in a view

How to get a sequential number of all the documents in a view. The sequential numbers will appear in a column of a view. I have used @DocNumber but it does not work when I preview my View from xpage page.

Upvotes: 1

Views: 137

Answers (3)

Stanislaw Guzik
Stanislaw Guzik

Reputation: 244

If you use viewPanel, there exists one simple solution.

Set the var property of your viewPanel to some meaningful name you like, e.g.

<xp:viewPanel var="viewEntry" ....etc....>
</xp:viewPanel>

By doing this, you provide yourself an explicit access to every iteration of DominoViewEntry (viewPanel uses it internally).

Then create a view column, don't set columnName property, set the value property. Like this:

<xp:viewColumn value="#{javascript:viewEntry.getPosition('.')}"
    id="docNumberColumn">
        <xp:viewColumnHeader value="Doc Number"
            id="docNumberHeader">
        </xp:viewColumnHeader>
</xp:viewColumn>

Sorry, no way to avoid SSJS here, because DominoViewEntry does not expose getPosition() method to its getValue() implementation, so we have to call it directly.

Update: this should work for dataTable and dataView as well, because all of them use UIDataIterator behind the scenes and both have var property.

Upvotes: 1

Patrick Kwinten
Patrick Kwinten

Reputation: 2048

Use repeat control and display the index number?

Upvotes: 0

Paul Stephen Withers
Paul Stephen Withers

Reputation: 15729

See https://www-10.lotus.com/ldd/ddwiki.nsf/dx/List_of_Formula_Not_Supported_In_XPages. @DocNumber is not supported in XPages.

Upvotes: 2

Related Questions