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 5, 2012, 6:18 AM
90 Posts

Totalling amounts in a view panel

  • Category: Other
  • Platform: Windows
  • Release: 8.5.3
  • Role: Developer
  • Tags: Totals
  • Replies: 5
 Making progress here!
 
This code produces an xpage that shows info like this:
 
Brown, John ($500)
1 May 1996 $500
 
Smith, Mary ($1050)
1 Nov 1998 $750
1 Jun 2007 $300
 
Now, at the very top of the page, I want to make a grand total for all the people's amounts. 
 
Any pointers?
 
 
<?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="xPrograms Related Donors"> </xp:dominoView>

        <xp:dominoView var="varDonationsView" viewName="(Donations for Update Agent)">
        </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="HowManyPeople">
        <xp:this.value>
            <![CDATA[#{javascript:getComponent("MasterRepeat").getRowCount();}]]>
        </xp:this.value>
        <xp:this.converter>
            <xp:convertNumber type="number" integerOnly="true"></xp:convertNumber>
        </xp:this.converter>
    </xp:text>
    &#160;People
    <xp:br></xp:br>
    <xp:br></xp:br>

    <xp:pager style="float: left" layout="Previous Group Next" partialRefresh="true"
        id="pager1" for="MasterRepeat">
    </xp:pager>
    <xp:br></xp:br>
    <xp:br></xp:br>
    <xp:repeat id="MasterRepeat" rows="200"
        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>
            &#160;&#160;
            <xp:text id="label1" escape="true">
                <xp:this.value>
                    <![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:this.converter>
                    <xp:convertNumber type="currency"></xp:convertNumber>
                </xp:this.converter>
            </xp:text>
        </h3>

        <xp:viewPanel rows="30" id="DonationsDisplay"
            viewStyle="width:250px" var="rowData">
            <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="varAmount"
                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:viewColumn id="RefDonorID" columnName="RefDonorCol"
                rendered="false">
                <xp:this.facets>
                    <xp:viewColumnHeader xp:key="header"
                        id="viewColumnHeader3" value="Ref person">
                    </xp:viewColumnHeader>
                </xp:this.facets>
            </xp:viewColumn>
        </xp:viewPanel>

    </xp:repeat>

</xp:view>
Mar 5, 2012, 7:03 AM
56 Posts
Re: Totalling amounts in a view panel
Forget about this post here...
 
Why is there no delete function?
Mar 5, 2012, 11:46 PM
90 Posts
Re: Totalling amounts in a view panel
no, don't forget about this post! I'm still trying to figure it out! Why on earth do you want to delete my post?
Mar 6, 2012, 9:12 AM
56 Posts
Re: Totalling amounts in a view panel
Ahhh, no panic here =)
"Forget about this post"  was directed to my own post. I wanted to answer you something and realized it was Bulls**t, so I removed it and tell you forget about what I wrote.
Please help this guy here, I have no idea at the moment =)
 
Sorry for the misunderstanding =)
Mar 6, 2012, 5:28 PM
14 Posts
Re: Totalling amounts in a view panel
 Could you use the same logic on a different view? Create a new view called "Donations for Update Agent Rollup" which sorts/categorizes by the total of all the people "RefDonorTotal"
Then you can use the same code to pull the total into a computed field or label.
 
 <![CDATA[#{javascript:var cView:NotesView = database.getView("(Donations for Update Agent Rollup)");

var nav:NotesViewNavigator = cView.createViewNav();

var keys = getComponent("RefDonorTotal").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];

}}]]> 
Mar 9, 2012, 1:10 AM
90 Posts
Re: Totalling amounts in a view panel
@ Matthias -- LOL, too funny!
 
@ Elijah -- okay I'll try thinking along those lines, thanks!

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