switch

Klaus Major klaus at major-k.de
Sat Mar 18 17:26:04 EST 2006


Hi Liam,

> what am I doing wrong here
>
> put fld "total" into ttotal
>   put fld "paymenttype" into tpayment
> ##!!  switch "tpayment"
## No quotes, since this is a variable!
>   case "credit"
>  ## if tpayment contains "credit" then put ttotal into fld "CreditDb"
## If tpayment = "credit" then it also contains "credit"! :-)
> ##exit switch
BREAK
> case "cash"
> ##if tpayment contains "cash" then put ttotal into fld "cash2"
## See above
> ##exit switch
break
> end switch

this should work:
...
   put fld "total" into ttotal
   put fld "paymenttype" into tpayment
   switch tpayment
   case "credit"
     put ttotal into fld "CreditDb"
     break
   case "cash"
     put ttotal into fld "cash2"
     break
   end switch
...

Hope that helps.

> Liam Lambert
> liamlambert at mac.com
> IRELAND

Regards

Klaus Major
klaus at major-k.de
http://www.major-k.de




More information about the use-livecode mailing list