Dave, This helped me a lot to understand things better!
thanks. > Sorry it took so long to get to this... my inbox keeps growing... sigh. > > Anyway, Order.scala: 64 should be: > > > def currentCost = Order.this.lots * > (Order.this.marketPlace.obj.map(_.lotValue.is) openOr 0 ) > > The marketplace field is a foreign key reference... so you have to get > the row that's represented by the foreign key (.obj) which is a > Box[MarketPlace] and then get the lotValue field from the marketplace. > > I'm enclosing the revised (compiling) files. > > Thanks, > > David > > On Sun, Jul 5, 2009 at 6:31 AM, Tobias Daub <hannes.flo...@gmx.li > <mailto:hannes.flo...@gmx.li>> wrote: > > here are the two files, thanks! > > Send me the file and I'll debug it. > > > > On Fri, Jul 3, 2009 at 3:06 AM, Tobias Daub > <hannes.flo...@gmx.li <mailto:hannes.flo...@gmx.li> > > <mailto:hannes.flo...@gmx.li <mailto:hannes.flo...@gmx.li>>> wrote: > > > > > > Thanks Dave, but still getting this error: > > > > > > /home/wacky/NetBeansProjects/virtualMarket/src/main/scala/org/tobster/model/Order.scala:51: > > error: value lotValue is not a member of Long > > override def _toForm = Full(<p>{Order.this.lots * > > Order.this.marketPlace.lotValue}</p>) > > > > > > What is the explanation for this behavior? > > > > thanks > > > > > > > > > On Sun, Jun 21, 2009 at 6:38 AM, Tobias Daub > > <hannes.flo...@gmx.li <mailto:hannes.flo...@gmx.li> > <mailto:hannes.flo...@gmx.li <mailto:hannes.flo...@gmx.li>> > > > <mailto:hannes.flo...@gmx.li <mailto:hannes.flo...@gmx.li> > <mailto:hannes.flo...@gmx.li <mailto:hannes.flo...@gmx.li>>>> wrote: > > > > > > > > > I'm stucked again with the simple things.... > > > > > > I've a trait that extends BaseLongKeyedMapper and I wanna > > add a field > > > (currentCost) that does some calculation. Nothing special. > > Here's > > > the code: > > > > > > /* > > > * Order.scala > > > * > > > * To change this template, choose Tools | Template > Manager > > > * and open the template in the editor. > > > */ > > > > > > package org.tobster.model > > > > > > import net.liftweb._ > > > import mapper._ > > > import http._ > > > import SHtml._ > > > import util._ > > > import model._ > > > > > > /* Describes a general order. */ > > > trait Order extends BaseLongKeyedMapper{ > > > > > > /* The number of lots this order has */ > > > object lots extends > MappedInt(this.asInstanceOf[MapperType]) > > > > > > /* The person who owns the order */ > > > object owner extends > > > MappedLongForeignKey(this.asInstanceOf[MapperType], User){ > > > > > > // hides this field in the CRUDify list/create > forms > > > override def dbDisplay_? = false > > > > > > //set the default value to the current logged > in user (at > > > creation time) > > > override def defaultValue = > > User.currentUser.map(_.id.is <http://id.is> <http://id.is> > > > <http://id.is>) openOr 0L > > > } > > > > > > /* The market place where the order belongs to */ > > > object marketPlace extends > > > MappedLongForeignKey(this.asInstanceOf[MapperType], > > > MarketPlaceMetaObj){ > > > override def _toForm = > Full(SHtml.selectObj[MarketPlace]( > > > > > MarketPlaceMetaObj.findAll.map(mp > > > => (mp, mp.name.is <http://mp.name.is> > <http://mp.name.is> <http://mp.name.is>)), > > > obj, > > > (mp: MarketPlace) => > > apply(mp))) > > > } > > > > > > /* The basic trade types are: BUY and SELL */ > > > object tradeType extends > > > MappedLongForeignKey(this.asInstanceOf[MapperType], > > TradeTypeMetaObj){ > > > override def _toForm = > Full(SHtml.selectObj[TradeType]( > > > TradeTypeMetaObj.findAll.map(t => (t, > > t.name.is <http://t.name.is> <http://t.name.is> > > > <http://t.name.is>)), > > > obj, > > > (t: TradeType) => apply(t))) > > > } > > > > > > > > > object currentCost extends > > > MappedInt(this.asInstanceOf[MapperType]){ > > > override def _toForm = Full(<p>{this.lots * > > > this.marketPlace.lotValue}</p>) > > > > > > > > > > > > Try: > > > override def _toForm = Full(<p>{Order.this.lots * > > > Order.this.marketPlace.lotValue}</p>) > > > > > > > > > > > > > > > } > > > > > > } > > > > > > I get the following compiler error: > > > > > > [WARNING] > > > > > > > /home/wacky/workspace_VirtuelleBoerse/virtualMarket/src/main/scala/org/tobster/model/Order.scala:51: > > > error: value lots is not a member of Int > > > [WARNING] override def _toForm = > Full(<p>{this.lots * > > > this.marketPlace.lotValue}</p>) > > > [WARNING] ^ > > > [WARNING] one error found > > > > > > The field marketPlace.lotValue is of type MappedInt as > well > > as the > > > field > > > lots. > > > > > > I tried things like "this.lots.is > <http://this.lots.is> <http://this.lots.is> > > <http://this.lots.is>" or > > > "this.lots.i_is_!" but without > > > success. I ran out of ideas... > > > > > > > > > thanks. > > > > > > > > > > > > > > > > > > -- > > > Lift, the simply functional web framework http://liftweb.net > > > Beginning Scala http://www.apress.com/book/view/1430219890 > > > Follow me: http://twitter.com/dpp > > > Git some: http://github.com/dpp > > > > > > > > > > > > > > > > > > > > > -- > > Lift, the simply functional web framework http://liftweb.net > > Beginning Scala http://www.apress.com/book/view/1430219890 > > Follow me: http://twitter.com/dpp > > Git some: http://github.com/dpp > > > > > > > > > > > > -- > Lift, the simply functional web framework http://liftweb.net > Beginning Scala http://www.apress.com/book/view/1430219890 > Follow me: http://twitter.com/dpp > Git some: http://github.com/dpp > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Lift" group. To post to this group, send email to liftweb@googlegroups.com To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/liftweb?hl=en -~----------~----~----~----~------~----~------~--~---