Akopia Akopia Services

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

[mv] Conditional comparison of the value of two variables



******    message to minivend-users from kswisher@iolinc.net (Swisher, Karl)     ******

Hello,
	I've been working over 3 days on about one line of code. The docs and
archieve list provided what seemed to be everything needed but it still doesn't
work.
	What I'm trying to do is simply compare 2 variables for equality.  The
variables are set with a form on the perviouse page and passed to the next
page with [tag flag build].  These variables are passed correctly and verified
with [value pass_var1] and [value pass_var2] being printed on the next page
where the comparison is made. Also the sql statement properly updates the
database when a true condition is returned.

	Any help will be appreciated.

	I'm using RH 6.1,  perl 5.00503 and  Minivend 3.14.

Thanks
Karl

 Here are only some of the examples I've tried.
--------------------------------------------------
[perl]
         $tmpvar1 = $Safe{'values'}->'{pass_var1}';
  	 $tmpvar2 = $Safe{'values'}->'{pass_var2}';
  	 if ('222222' eq '222222') { 		
		[sql type=set interpolate=1]
			update recotable_tbl set var1=[value pass_var1] where trim(recoid) ='[value pass_recoid]'
		[/sql]
		return "Update was successful";
	} else {
		return "Update was not successful";
           }
[/perl]

The condition statement only works if  the "$tmpvar1" and "$tmpvar2" lines are
deleted. Since the "$tmpvar's"  are not used in the above comparison, the code
should work with or without the two "$tmpvar" lines.  Have verified that the
"pass_var's" are being passed to the "$tmpvar's" by modifying the above example
just to return the "$tmpvar's".
-------------------------------------------------
[if type="explicit" name="$Value->{pass_var1}" op="eq"  compare="$Value->{pass_var12}"]
	[sql type=set interpolate=1]
		update recotable_tbl set var1=[value pass_var1] where trim(recoid) ='[value pass_recoid]'
	[/sql]
	Update update was successful
[else]
	Update was not successful.
[/else]
[/if]

This example always return a true condition even
if the variables are different
------------------------------------------------
[if type="explicit" compare="$Value->{pass_var1} eq '$Value->{pass_var2}'"]
	[sql type=set interpolate=1]
		update recotable_tbl set var1=[value pass_var1] where trim(recoid) ='[value pass_recoid]'
	[/sql]
	Update was successful
[else]
	Update was not successful
[/else]
[/if]

This example always return a false condition even
if the variables are equal
------------------------------------------------
[if explicit]
[condition]
$tmpvar1 = $Safe{'values'}->'{pass_var1}';
$tmpvar2 = $Safe{'values'}->'{pass_var2}';
	return 1 if '222222' eq '222222';
        return 0;
[/condition]
	[sql type=set interpolate=1]
		update recotable_tbl set var1=[value pass_var1] where trim(recoid) ='[value pass_recoid]'
	[/sql]
	Update was successful
[else]
	Update was not successful
[/else]
[/if]

This example always return a false condition even
if you set the comparison to '222222' eq '222222'
-----------------------------------------------
[if explicit [value pass_var1] eq  /[value pass_var2]/ ]

	[sql type=set interpolate=1]
		update recotable_tbl set var1=[value pass_var1] where trim(recoid) ='[value pass_recoid]'
	[/sql]

	Update was successful
[else]
	Update was not successful
[/else]
[/if]
This example always return a false condition.
------------------------------------------------
-
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: