Re: Collection Class object enhancements




"wb" <none> wrote
I have a collection class that I created to store LineItem objects of a
shopping cart.
<...>
Inside my collection class I want to have something that tabulates the total
of each item.
<...>
I also created a countNumberId function that takes the item Id (NC001) and
will return the sum of quantity.
<...>
This works ok, but I think there might be a better way to accomplish this.
Suggestions?

It appears the collection is the shopping cart for one user. Since you know
you will want a tally of the individual items ordered, why not keep a list of
distinct items, instead of the line item scenareo. If they scan the same item
twice, it increments that item, rather than creating a new line item. etc...

When you return the Count, it should be the sum total of all items ordered.
There would be no need for the countNumberID function because every
different item would have its 'quantity ordered' already stored, easily available.

LFS



.



Relevant Pages

  • Re: Collection Class object enhancements
    ... End users can scan items into the shopping cart through a ... barcode scanner and each item is added. ... will return the sum of quantity. ... case is that you actually have two related but separate associations. ...
    (microsoft.public.vb.general.discussion)
  • Re: Is this possible?
    ... About your result being different - do you have a formula or value in cell ... yours was doing with the 10% and $75 yet fail to see where the sum ... Next question is if I have 1% increments and not 10% then what do I ... phat al's Profile: ...
    (microsoft.public.excel.worksheet.functions)
  • Re: Random double-stochastic matrices
    ... sum of each row is exactly 1). ... Is that what you have in mind? ... What kind of random distribution are you seeking? ... one increments that element by a random amount delta, ...
    (comp.soft-sys.matlab)
  • Re: Is this possible?
    ... Good point Arvi I don?t think i don?t think I do explain things ... yours was doing with the 10% and $75 yet fail to see where the sum ... Next question is if I have 1% increments and not 10% then what do I ... phat al's Profile: http://www.excelforum.com/member.php?action=getinfo&userid=34988 ...
    (microsoft.public.excel.worksheet.functions)
  • Re: How can I find the greatest possible sum within 12 months? A newbie...
    ... the starting sum is in A2 and the end sum is in A123. ... date increments are random - so it is not always from a specific date ... Roger Govier schrieb: ... Excel will insert them for you. ...
    (microsoft.public.excel.worksheet.functions)