Akopia Akopia Services

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

Re: [mv] Comparing numeric value using IF



******    message to minivend-users from Viktors Rotanovs <viktors@riga.nu>     ******

Hi Curt,

try the following code:
Value of my_field is [value my_field]<br>
CGI Value of my_field is [cgi my_field]<br>
[if value my_field == 1]
my_field is 1
[else]
my_field is not 1
[/else]
[/if]<br>

Hope this helps.

On Mon, 03 Jul 2000, you wrote:
> ******    message to minivend-users from "Curt Hauge" <chc@mninter.net>    
> ******
>
> Hi List,
>
> On MV 4.04, Linux Mandrake 6.0, I have been trying to do what seems to be a
> simple comparison of numeric values. I have researched the docs and several
> perl sites, but still can't get the desired result. Basically, I wish to
> check the value of My_field to see if it is equal to 1 (It is either 1 or
> 0). Here is a sample of what I have tried:
>
> [if type="value" term="My_field" op="==" compare="1"]
> Hello
> [/if]
> (tried op="eq", op="=~", term="[item-data My_file My_field]",
> compare="/1/", compare="^1", compare="/^1/", and several variations of
> these)
>
> also:
>
> [if value My_field == /^1/]
> Hello
> [/if]
>
> which always produces Hello, whether value is a 1 or 0
>
> (tried =~, [My_field], [item-data My_file My_field], == 1, == ^1, and
> variants)
>
> and:
> [if explicit]
>     [condition]
>         $My_value = '[value My_field]';
>         return 1 if $My_value =~ /1/;
>         return 0;
>     [/condition]
> Hello
> [/if]
>
> (tried [value [item-data My-file My_field]], [value [My_field]], ==, and
> variants)
>
> A sampling of error log, in no particular order:
>
> Bad if 'value My_field == ^1': syntax error at (eval 323) line 1, near "==
> ^"
> Bad if 'value My_field =~ ^1': syntax error at (eval 354) line 1, near "=~
> ^"
> Bad if 'value 0 = 1': Can't modify constant item in scalar assignment at
> (eval 357) line 2, at EOF
> Bad if 'value My_field = 1': Can't modify constant item in scalar
> assignment at (eval 349) line 2, at EOF
> Bad if 'value 0 g [My_field]': syntax error at (eval 303) line 1, near "q{}
> g "
> Bad if 'value My_field = 1': Can't modify constant item in scalar
> assignment at (eval 351) line 2, at EOF
>
> It has been several hours of trial and error and, while I do have a
> workaround (which is not based on a conditional expression), I really wish
> to do it this way. All help is greatly appreciated.
>
> Thanks in advance,
>
> Curt
>
>
> -
> 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

-- 
Best Wishes,
Viktors Rotanovs,     DATIONS SIA,        Riga, Latvia
Phone +371-7377-142   GSM +371-9173-000   Fax +371-7377-472
http://riga.nu/       ICQ 71718405
-
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: