This forum is closed to new posts and responses. Individual names altered for privacy purposes. The information contained in this website is provided for informational purposes only and should not be construed as a forum for customer support requests. Any customer support requests should be directed to the official HCL customer support channels below:

HCL Software Customer Support Portal for U.S. Federal Government clients
HCL Software Customer Support Portal



Mar 3, 2012, 9:04 AM
90 Posts

Filtering a nested repeat

  • Category: Other
  • Platform: Windows
  • Release: 8.5.3
  • Role: Developer
  • Tags: repeats
  • Replies: 6
On an xpage, I want to show a person, then below the person name, child docs showing what that person has donated, then next person and similar donation records, etc. The person records are in one view; the donation documents are in a separate view.
 
I can key on unique UUID field called RefPerson.
 
I'm stuck on how to filter the nested repeat called "Donation Repeat" on that key.
 
Any help appreciated.
 
__________________________
 
<?xml version="1.0" encoding="UTF-8"?>
<xp:view xmlns:xp="http://www.ibm.com/xsp/core">

    <xp:this.data>
        <xp:dominoView var="varProgramsRelatedDonors" viewName="Programs Related Donors"></xp:dominoView>
        <xp:dominoView var="varDonationsView" viewName="(Donations for Update Agent)"> </xp:dominoView>
    </xp:this.data>

    <xp:br></xp:br>

    <xp:repeat id="MasterRepeat" rows="30" value="#{varProgramsRelatedDonors}" var="personData">
        <xp:panel>
            <xp:text escape="true" id="computedField3"
                value="#{personData.NameOfDonor}">
            </xp:text>
        </xp:panel>
               
        <xp:repeat id="DonationRepeat" rows="30" value="#{personData.RefPerson}" var="donationData">
            <xp:table style="width:500px">
            <xp:tr>
            <xp:td>
            <xp:text escape="true" id="xDateOfGift" value="#{javascript:@Text(donationData.DateOfGift)}"></xp:text>
            </xp:td>
            <xp:td>
            <xp:text escape="true" id="xAmount" value="#{javascript: @Text(donationData.Amount)}" style="float: left"></xp:text>
            </xp:td>
            </xp:tr>
            </xp:table>
        </xp:repeat>
    </xp:repeat>
    </xp:view>
Mar 3, 2012, 3:44 PM
586 Posts
Re: Filtering a nested repeat
 If I understand you correctly, what you want to do is a repeat within a repeat.  Basically a Nested repeat.
 
 
Also there's a demo of what I think you what want on XPagesCheatSheet.com.  Look on the left side at "Repeat2" and "Repeat3".  That app can be downloading from the site if you need to pick it apart.  But hopefully the video has enough it it.
 
I'm sure this is also covered in other vidoes.  Show 18 - Data Relationships come to mind...  Not sure though. 
 
Hope that helps! 
 
Dave 
 
 
Mar 3, 2012, 10:28 PM
90 Posts
Re: Filtering a nested repeat
Okay I did what I'm sure is some kind of mutant hack, and sort of got it working. 
 
I'm stumped as to where to put the Pager, though. If I put it inside the section I called "Master Repeat", then I get a repeated pager all down the page. If it put it anywhere else, the page won't load, with an error about pager not having any data to work with.
 
Any hints how to salvage this, or is it all just so wrong that it needs ripping apart?
 
___________________________________________
 
 
 
<?xml version="1.0" encoding="UTF-8"?>
<xp:view xmlns:xp="http://www.ibm.com/xsp/core">


    <xp:this.data>
        <xp:dominoView var="varProgramsRelatedDonors"
            viewName="Programs Related Donors">
        </xp:dominoView>

    </xp:this.data>
    <xp:this.resources>
        <xp:styleSheet href="/screen.css"></xp:styleSheet>
    </xp:this.resources>
    <xp:br></xp:br>
    <xp:br></xp:br>
    <xp:text escape="true" id="computedField2">
        <xp:this.value>
            <![CDATA[#{javascript:getComponent("MasterRepeat").getRowCount();}]]>
        </xp:this.value>
    </xp:text>
    <xp:br></xp:br>
    <xp:br></xp:br>

    <xp:repeat id="MasterRepeat" rows="30" value="#{varProgramsRelatedDonors}" var="personData">
    <xp:text style="display: none" escape="true" id="RefDonor" value="#{personData.RefPerson}">
            </xp:text>
            <h3><xp:text escape="true" id="computedField3" value="#{personData.NameOfDonor}">
            </xp:text></h3>
                    <xp:label id="label1">
                    <xp:this.value>
                    Total: <![CDATA[#{javascript:
                    var cView:NotesView = database.getView("(Donations for Update Agent)");
                    var nav:NotesViewNavigator = cView.createViewNav();
                    var keys = getComponent("RefDonor").getValue();
                    // Since you can’t do ‘getCategory’ – find the first doc and backup 1
                    var entry:NotesViewEntry = cView.getEntryByKey(keys);
                    entry = nav.getPrev(entry);
                    if (entry == null) {
                    // Nothing to Do
                    }
                    else {
                    return entry.getColumnValues()[3];
                    }}]]>
                    </xp:this.value>
                </xp:label>
            <xp:viewPanel rows="30" id="DonationsDisplay" viewStyle="width:250px">
            <xp:this.data>
                <xp:dominoView var="DonationsView" viewName="(Donations for Update Agent)">
                    <xp:this.keys><![CDATA[#{javascript:
                var keys = getComponent("RefDonor").getValue();
                return keys;}]]></xp:this.keys>
                </xp:dominoView>
            </xp:this.data>

            <xp:viewColumn columnName="DateOfGift" id="viewColumn1" style="width:100px">
                <xp:viewColumnHeader value="DateOfGift"
                    id="viewColumnHeader1">
                </xp:viewColumnHeader>
            </xp:viewColumn>
            <xp:viewColumn columnName="Amount" id="viewColumn2" style="width:100px;text-align:right">
                <xp:this.converter>
                    <xp:convertNumber type="currency"></xp:convertNumber>
                </xp:this.converter>
                <xp:viewColumnHeader value="Amount" id="viewColumnHeader2">
                </xp:viewColumnHeader>

            </xp:viewColumn>

</xp:viewPanel>

    </xp:repeat>

    <xp:br></xp:br>
    <xp:br></xp:br>
</xp:view>
Mar 4, 2012, 12:15 PM
586 Posts
Re: Filtering a nested repeat
 I've not looked at your code yet....  do you want 2 pages?  1 for the master and another the for nested stuff?
 
Make sure your master pager is outside the repeat itself.  Put it above it for instance and make sure it's bound to the right one.  The nest pages should be the same I'd think.  Put it above the nested repeat.  So it's inside the master but not inside the master so it repeats every row. 
 
Let me know if this works.  If not I'll try to do a NotesIn9 on this. 
Mar 5, 2012, 11:55 PM
90 Posts
Re: Filtering a nested repeat
Thanks for the pager tip. It made me realize that I could put the pager anywhere on the page as long as I bound it to something.
Mar 6, 2012, 10:14 PM
272 Posts
Re: Filtering a nested repeat
But keep in mind: If you use a pager outside the bounded component will cause to recalculate all components surrounded by the pager.
 
Sven
 

This forum is closed to new posts and responses. Individual names altered for privacy purposes. The information contained in this website is provided for informational purposes only and should not be construed as a forum for customer support requests. Any customer support requests should be directed to the official HCL customer support channels below:

HCL Software Customer Support Portal for U.S. Federal Government clients
HCL Software Customer Support Portal