Bitwyse1
Bitwyse1

Reputation: 339

How to set the data source to a notes document

I have a button that does a dblookup to fetch a notesDocument . I would like to set the datasource to that document so I could use it elsewhere in my xpage.

For example, I have three different buttons that act upon the same document. I don't want to have to lookup that document in each button.

I tried setting the data source docUNID to a scope variable that is updated in the first button that does the dblookup, then refreshes the xPage, but that doesn't seem to update the data source.

Any thoughts?

Upvotes: 0

Views: 339

Answers (1)

Thomas Adrian
Thomas Adrian

Reputation: 3636

make sure your dblookup return a docunid and add your dblookup to the documentUniqueID property in the docment data source to the xpages and then use the data source variable to save or update values

There is a keyword on dblookup for getting the unid or you can return a column containing the unid

something like this

<xp:panel>
    <xp:this.data>
        <xp:dominoDocument var="doc" action="openDocument"
            documentId="#{javascript:@DbLookup(...)}">
        </xp:dominoDocument>
    </xp:this.data>
    <xp:button value="Label" id="button1">
        <xp:eventHandler event="onclick" submit="true"
            refreshMode="complete">
            <xp:this.action><![CDATA[#{javascript:doc.save()}]]></xp:this.action>
        </xp:eventHandler></xp:button>
    <xp:button value="Label" id="button2">
        <xp:eventHandler event="onclick" submit="true"
            refreshMode="complete">
            <xp:this.action><![CDATA[#{javascript:doc.save()}]]></xp:this.action>
        </xp:eventHandler></xp:button>
    <xp:button value="Label" id="button3">
        <xp:eventHandler event="onclick" submit="true"
            refreshMode="complete">
            <xp:this.action><![CDATA[#{javascript:doc.save()}]]></xp:this.action>
        </xp:eventHandler></xp:button>

Upvotes: 1

Related Questions