Note that there are some explanatory texts on larger screens.

plurals
  1. POGet handle to the documents inside a panel which is within a repeat control from outside the repeat control
    primarykey
    data
    text
    <p>I am working on this functionality where-in I need to provide the user with a list of documents and provide an option for the user to change/add values to a field(s) inside these documents. I was going through this example <a href="https://stackoverflow.com/questions/13514975/xpages-display-filtered-document-collection-in-a-repeat-control">Xpages - Display filtered Document Collection in a repeat control</a> and did a similar implementation and got it to work. So what I have now is a panel inside a repeat which has its data source set with the form and document id set to return the value in the repeat control variable (which is the document UNID from the document collection), thus I am able to bind fields directly to these documents using the data source defined in the panel. The challenge is that I want to get the handle to these documents to set a particular value in them and also save the values in the fields that I bind to the back-end document. Is there any way I can access the documents from outside the repeat control (let say on the click of a button)? Following is my code for the repeat:</p> <pre><code> &lt;xp:repeat id="rptApprDocuments" rows="30" var="apprDoc" indexVar="docIndex" first="0"&gt; &lt;xp:this.value&gt;&lt;![CDATA[#{javascript:// Look up the employee details view to get the employee appraisal details from the current database var curDB:NotesDatabase = session.getCurrentDatabase(); var vwlkApprView:NotesView = curDB.getView("vwlkApprAllFGCompAppr"); var collDocAppr:NotesDocumentCollection = vwlkApprView.getAllDocumentsByKey(sessionScope.key); var apprDocCount = collDocAppr.getCount(); if(apprDocCount != 0){ var docAppr:NotesDocument; var docUNIDArray = new Array(); for(i=0;i&lt;apprDocCount;i++){ docAppr = collDocAppr.getNthDocument(i+1); //print(docAppr.getUniversalID()); docUNIDArray.push(docAppr.getUniversalID()); } viewScope.put("docUNIDArray",docUNIDArray); return docUNIDArray; /*return collDocAppr; /return sortColByItemName(collDocAppr, "AppraiseeCWLCluster");*/ } return null; ]]&gt;&lt;/xp:this.value&gt; &lt;xp:panel id="pnlRR"&gt; &lt;xp:this.data&gt; &lt;xp:dominoDocument formName="frmAppraisal" var="appraisalDoc" action="editDocument" ignoreRequestParams="true"&gt; &lt;xp:this.postSaveDocument&gt;&lt;![CDATA[#{javascript:if(requestScope.SubmitRR == true){ appraisalDoc.setValue("ApperRRStatus","1"); appraisalDoc.save(); }}]]&gt;&lt;/xp:this.postSaveDocument&gt; &lt;xp:this.documentId&gt;&lt;![CDATA[#{javascript://apprDoc.getUniversalID(); return apprDoc;}]]&gt;&lt;/xp:this.documentId&gt; &lt;/xp:dominoDocument&gt; &lt;/xp:this.data&gt; &lt;xp:tr&gt; &lt;xp:td styleClass="tdCls" style="width:2%"&gt; &lt;xp:label id="SrNo"&gt; &lt;xp:this.value&gt;&lt;![CDATA[#{javascript:var index = parseInt(docIndex) index = index + 1; index.toString();}]]&gt;&lt;/xp:this.value&gt; &lt;/xp:label&gt; &lt;/xp:td&gt; &lt;xp:td styleClass="tdCls" style="width:20.0%"&gt; &lt;xp:label id="ApeName"&gt; &lt;xp:this.value&gt;&lt;![CDATA[#{javascript://return apprDoc.getItemValueString("AppraiseeName"); return appraisalDoc.getItemValueString("AppraiseeName");}]]&gt;&lt;/xp:this.value&gt; &lt;/xp:label&gt; &lt;/xp:td&gt; &lt;xp:td styleClass="tdCls" style="width:8.0%"&gt; &lt;xp:label id="ApeGrade"&gt; &lt;xp:this.value&gt;&lt;![CDATA[#{javascript://return apprDoc.getItemValueString("Appraisee_Grade"); return appraisalDoc.getItemValueString("Appraisee_Grade");}]]&gt;&lt;/xp:this.value&gt; &lt;/xp:label&gt; &lt;/xp:td&gt; &lt;xp:td styleClass="tdCls" style="width:15.0%"&gt; &lt;xp:div style="text-align:center"&gt; &lt;xp:label id="appeTotImpRate" style="font-size:10pt;color:rgb(255,0,0);font-weight:bold"&gt; &lt;xp:this.value&gt;&lt;![CDATA[#{javascript://return apprDoc.getItemValueDouble("AppeTotImpRate").toFixed(2); return appraisalDoc.getItemValueDouble("AppeTotImpRate").toFixed(2);}]]&gt;&lt;/xp:this.value&gt; &lt;/xp:label&gt; &lt;/xp:div&gt; &lt;/xp:td&gt; &lt;xp:td styleClass="tdCls" style="width:15.0%"&gt; &lt;xp:div style="text-align:center"&gt; &lt;xp:label id="apprTotImpRate" style="color:rgb(255,0,0);font-size:10pt;font-weight:bold"&gt; &lt;xp:this.value&gt;&lt;![CDATA[#{javascript://return apprDoc.getItemValueDouble("ApprTotImpRate").toFixed(2); return appraisalDoc.getItemValueDouble("ApprTotImpRate").toFixed(2);}]]&gt;&lt;/xp:this.value&gt; &lt;/xp:label&gt; &lt;/xp:div&gt; &lt;/xp:td&gt; &lt;xp:td styleClass="tdCls" style="width:15.0%"&gt; &lt;xp:div style="text-align:center"&gt; &lt;xp:label id="revTotImpRate" style="font-size:10pt;color:rgb(255,0,0);font-weight:bold"&gt; &lt;xp:this.value&gt;&lt;![CDATA[#{javascript://return apprDoc.getItemValueDouble("RevTotImpRate").toFixed(2); return appraisalDoc.getItemValueDouble("RevTotImpRate").toFixed(2);}]]&gt;&lt;/xp:this.value&gt; &lt;/xp:label&gt; &lt;/xp:div&gt; &lt;/xp:td&gt; &lt;xp:td styleClass="tdCls" style="width:12.0%"&gt; &lt;xp:div style="font-size:10pt;color:rgb(255,0,0);font-weight:bold;text-align:center"&gt; &lt;xp:comboBox id="apprGrades" style="width:50.0px" disableClientSideValidation="true" value="#{appraisalDoc.ApperFinalGrade}" readonly="true"&gt; &lt;xp:selectItem itemLabel="-" itemValue="" id="selectItem1"&gt; &lt;/xp:selectItem&gt; &lt;xp:selectItem itemLabel="1" itemValue="1" id="selectItem2"&gt; &lt;/xp:selectItem&gt; &lt;xp:selectItem itemLabel="2" itemValue="2" id="selectItem3"&gt; &lt;/xp:selectItem&gt; &lt;xp:selectItem itemLabel="3" itemValue="3" id="selectItem4"&gt; &lt;/xp:selectItem&gt; &lt;xp:selectItem itemLabel="4" itemValue="4" id="selectItem5"&gt; &lt;/xp:selectItem&gt; &lt;xp:selectItem itemLabel="5" itemValue="5" id="selectItem6"&gt; &lt;/xp:selectItem&gt; &lt;/xp:comboBox&gt; &lt;/xp:div&gt; &lt;/xp:td&gt; &lt;xp:td styleClass="tdCls" style="width:12.0%"&gt; &lt;xp:div style="font-size:10pt;color:rgb(255,0,0);font-weight:bold;text-align:center"&gt; &lt;xp:comboBox id="ApperRelativeRank" style="width:50.0px" disableClientSideValidation="true" value="#{appraisalDoc.ApperRelativeRank}"&gt; &lt;xp:this.readonly&gt;&lt;![CDATA[#{javascript:/*if(compositeData.UserRole == "Appraiser"){ return true; } if(parseInt(appraisalDoc.getValue("CurrFGRRStatus")) &gt;= parseInt(compositeData.compStatus)){ return true; }*/ return false;}]]&gt;&lt;/xp:this.readonly&gt; &lt;xp:this.rendered&gt;&lt;![CDATA[#{javascript:/*if(compositeData.UserRole == "Appraiser"){ return false; }*/ return true;}]]&gt;&lt;/xp:this.rendered&gt; &lt;xp:selectItem itemLabel="-" itemValue="" id="selectItem13"&gt; &lt;/xp:selectItem&gt; &lt;xp:selectItems&gt; &lt;xp:this.value&gt;&lt;![CDATA[#{javascript:// Look up the employee details view to get the employee appraisal details from the current database var curDB:NotesDatabase = session.getCurrentDatabase(); var vwlkApprView:NotesView = curDB.getView("vwlkCWLApprAllFGCompAppr"); var cwlCluster = appraisalDoc.getItemValueString("AppraiseeCWLCluster"); var collEntAppr:NotesViewEntryCollection = vwlkApprView.getAllEntriesByKey(sessionScope.key + cwlCluster); var entCount = collEntAppr.getCount() if(entCount != 0){ var ranks = new Array(); var rankValue, rankLabel; for(i=0;i&lt;entCount;i++){ rankValue = i + 1; rankLabel = rankValue + "/" + entCount; ranks.push(rankLabel + "|" + rankValue); } return ranks; } return null;}]]&gt;&lt;/xp:this.value&gt; &lt;/xp:selectItems&gt; &lt;/xp:comboBox&gt; &lt;/xp:div&gt; &lt;/xp:td&gt; &lt;/xp:tr&gt; &lt;/xp:panel&gt; &lt;/xp:repeat&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload