MiniVend Akopia Services

[Date Prev][Date Next][Thread Prev][Thread Next][Minivend by date ][Minivend by thread ]

Re: Problems with discount formula



******    message to minivend-users from Mike Lerley <mike@bfent.com>     ******

OK, I'll buy that.  And in fact I knew that.  I understand my confusion now, however, for when I change
== to eq, the category that should not be discounted is always discounted.  I have inserted a
[item-field category] into the [item-list] below it and verified that what it is pulling from the
database is in fact exactly what I am comparing it to.  So my question is, why is it not returning when
it should?  Am I missing some punctuation or something else?
-mike


> Quoting Mike Lerley (mike@bfent.com):
> > ******    message to minivend-users from Mike Lerley <mike@bfent.com>     ******
> >
> > I tested this extensively and determined that == was the operator of choice.  I did
> > think about that, though.  If that was the case, however, all products would be
> > returned discounted rather than NOT discounted, because the first return statement
> > would fail.  What is in fact happening is that all products are being returned NOT
> > discounted.
>
> I beg to differ. 'eq' is the string equality operator in Perl. Right now
> you are doing a numeric comparison on two strings, which will always be
> true; both evaluate to 0. So nothing will ever be discounted.
>
> Mike
>
> > -mike
> >
> > Joe Hourcle wrote:
> >
> > > ******    message to minivend-users from Joe Hourcle <oneiros@dcr.net>     ******
> > >
> > > On Fri, 15 Jan 1999, Mike Lerley wrote:
> > >
> > > > ******    message to minivend-users from Mike Lerley <mike@bfent.com>     ******
> > > >
> > > > Will somebody please tell me why the following code, modeled after the
> > > > docs, does not work correctly:
> > > >
> > > > [calc]
> > > >         [item-list]
> > > >                 $totalq{"[item-field category]"} += [item-quantity];
> > > >         [/item-list]
> > > >         return '';
> > > > [/calc]
> > > > [discount ALL_ITEMS]
> > > >         return $s if "[item-field category]" == "Cold Bay Seafood";
> > > >         return 17*$q*5 if $totalq{"Hanson Bros."} >= 10;
> > > >         return (27-$q)*5*$q;
> > > > [/discount]
> > >
> > > as I think [discount] passes everything to perl, you may want to try using
> > > 'eq' inplace of '==' as it's a string comparison, not a number comparison.
> > >
> > > -----
> > > Joe Hourcle
> > > Digital Crescent, Inc.
> > >
> > > -
> > > To unsubscribe from the list, DO NOT REPLY to this message.  Instead, send
> > > email with 'UNSUBSCRIBE minivend-users' in the body to Majordomo@minivend.com.
> > > Archive of past messages: http://www.minivend.com/minivend/minivend-list
> >
> > -
> > To unsubscribe from the list, DO NOT REPLY to this message.  Instead, send
> > email with 'UNSUBSCRIBE minivend-users' in the body to Majordomo@minivend.com.
> > Archive of past messages: http://www.minivend.com/minivend/minivend-list
> >
>
> --
> Mike Heins                          http://www.minivend.com/  ___
>                                     Internet Robotics        |_ _|____
> Fast, reliable, cheap.              131 Willow Lane, Floor 2  | ||  _ \
> Pick two and we'll talk.            Oxford, OH  45056         | || |_) |
>  -- unknown                         <mikeh@minivend.com>     |___|  _ <
>                                     513.523.7621 FAX 7501        |_| \_\

--
Mike Lerley, System Integrator
BonFire Enterprises
56 Leighton Road
Augusta, ME 04330
Email mike@bfent.com
Phone (207) 622-3298
Fax   (207) 623-5125


-
To unsubscribe from the list, DO NOT REPLY to this message.  Instead, send
email with 'UNSUBSCRIBE minivend-users' in the body to Majordomo@minivend.com.
Archive of past messages: http://www.minivend.com/minivend/minivend-list


Search for: Match: Format: Sort by: