Aggregate on a Custom Property


Author
Message
Trent Taylor
Trent Taylor
StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 6.9K
I just scanned over your code and didn't really digest it...but from the looks of it you have it going, so let me know if you are still having issues.
Bill Cunnien
Bill Cunnien
StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)
Group: Forum Members
Posts: 785, Visits: 3.6K
Oops!  Blink

mGrandTotal += mBO.grandtotal;


Bill Cunnien
Bill Cunnien
StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)
Group: Forum Members
Posts: 785, Visits: 3.6K
Cool...so I could do this, then:

public decimal GetBatchTotal()
{
   
decimal mGrandTotal = 0;
   
foreach (InvoiceMasterBO mBO in this.GetEnumerable())
    {
        mGrandTotal +=
this.grandtotal;
    }
   
return mGrandTotal;
}

Lean and mean! Smile


Ivan George Borges
Ivan George Borges
Strategic Support Team Member (3.6K reputation)Strategic Support Team Member (3.6K reputation)Strategic Support Team Member (3.6K reputation)Strategic Support Team Member (3.6K reputation)Strategic Support Team Member (3.6K reputation)Strategic Support Team Member (3.6K reputation)Strategic Support Team Member (3.6K reputation)Strategic Support Team Member (3.6K reputation)Strategic Support Team Member (3.6K reputation)
Group: StrataFrame MVPs
Posts: 1.9K, Visits: 21K
Hey Bill.

This is not really about your question, but rather the way you are moving through your BO rows. Have a look at this post from Trent:

http://forum.strataframe.net/FindPost16281.aspx

Bill Cunnien
Bill Cunnien
StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)
Group: Forum Members
Posts: 785, Visits: 3.6K
Do I even need a sub-reference to the same BO?  I am over-thinking this stuff sometimes.  Could I do this, instead?

public decimal GetBatchTotal()
{
   
decimal mGrandTotal = 0;
   
if (this.MoveFirst())
    {
       
do
       
{
            mGrandTotal +=
this.grandtotal;
        }
       
while (this.MoveNext());
    }
   
return mGrandTotal;
}

A little cleaner...less filling...even greener...

Hehe


Bill Cunnien
Bill Cunnien
StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)
Group: Forum Members
Posts: 785, Visits: 3.6K

This kinda feels like atrick question....

BigGrin

Naw...just the Friday-I-Want-To-Get-Out-Of-The-Office-Mentality!  I . . . must . . . stay . . . focused . . .

Ok...here is the answer that I came up with to the trick question--I put this in the InvoiceMasterBO:

public decimal GetBatchTotal(String pBatchID)
{
   
InvoiceMasterBO mInvoiceBatch = new InvoiceMasterBO();
    mInvoiceBatch.FillByBatchID(pBatchID);
   
decimal mGrandTotal = 0;
   
if (mInvoiceBatch.MoveFirst())
    {
       
do
       
{
            mGrandTotal += mInvoiceBatch.grandtotal;
        }
       
while (mInvoiceBatch.MoveNext());
    }
   
return mGrandTotal;
}

Whaddya think?
Bill


Trent Taylor
Trent Taylor
StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 6.9K
This kinda feels like atrick question....since you are using a custom property, you can do anything that you want....cycle through the rows in the BO, execute another query, pull from a sproc...you can do anything that you want at this point, so I guess I don't really know how to answer this post.  Smile
Bill Cunnien
Bill Cunnien
StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)
Group: Forum Members
Posts: 785, Visits: 3.6K
I did some preliminary searches in these forums and I have hit the docs, but I am not coming up with a way to perform an aggregate on a custom property.  Can anyone point me in the right direction?

Here is an example...I have a BO called InvoiceMasterBO.  The BO has a custom property called 'grandtotal' which summarizes the finance info on each invoice.  I need to send a batch of these invoices to the accounting system.  For a double check and a requirement of the accounting system, I need to export the SUM(grandtotal), too.  How do I do that?

This is probably so obvious that I will kick myself as soon as I find out how to do it.

Thanks,
Bill

GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search