Note that there are some explanatory texts on larger screens.

plurals
  1. PODynamic binding within a repeat control
    primarykey
    data
    text
    <p>In a purchase order module, we need to ask certain questions depending on the source selection method, competition type and total cost of the PO. These questions are likely to change over time and in between different instances of the database.</p> <p>So I have a view containing the questions, so that I can add questions dynamically to my XPage without needing to change the code. The answer to each question will be stored in a field. So, the document that contains the question has a field called FieldName that is used to supply the field name that will be used. Unfortunately, I am having no luck binding these dynamic fields to the document.</p> <pre><code>&lt;xp:this.data&gt; &lt;xp:dominoView var="competitionQuestionView" viewName="CompetitionQuestions"&gt; &lt;/xp:dominoView&gt; &lt;/xp:this.data&gt; &lt;xp:repeat id="repeat2" rows="30" var="rowData" style="width:700px" value="#{competitionQuestionView}"&gt; &lt;xp:label id="label1"&gt; &lt;xp:this.value&gt;&lt;![CDATA[#{javascript:rowData.getColumnValue("Question");}]]&gt;&lt;/xp:this.value&gt; &lt;/xp:label&gt; &lt;xp:inputText id="inputText1"&gt; &lt;xp:this.rendered&gt;&lt;![CDATA[#{javascript:rowData.getColumnValue("FieldType") == "Text Box"; }]]&gt;&lt;/xp:this.rendered&gt; &lt;xp:this.value&gt;&lt;![CDATA[#{javascript:poDoc[rowData.getColumnValue ("FieldName")];}]]&gt;&lt;/xp:this.value&gt; &lt;/xp:inputText&gt; &lt;/xp:repeat&gt; </code></pre> <p>I've tried various ways to do this, including making a dynamicInputText custom control to pass in the field name, but without luck. The closest I got was when I used this:</p> <pre><code>&lt;xp:this.value&gt; &lt;![CDATA[#{javascript:tmp = rowData.getColumnValue ("FieldName");'#{poDoc.'+tmp+'}';}]]&gt; &lt;/xp:this.value&gt; </code></pre> <p>That gave me something like <em>#{poDoc.justification}</em>, which was what I wanted to pass to the 'binding', but it ended up displaying as the text value.</p> <p>I did try using $ to compute the value on load, but I am guessing that it didn't work because my (and the rowData) view is not available on load. That would eventually present a problem when I wanted to use partial refreshes due to updates on the criteria for which fields I want to display anyway.</p> <p>Some of the answers to other questions looked promising, but no code was provided, so I couldn't figure it out.</p>
    singulars
    1. This table or related slice is empty.
    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.
 

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