Akopia Akopia Services

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

Re: [mv] Conditional comparison of the value of two variables



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

> On Wed, 29 Mar 2000, you wrote:
> > ******    message to minivend-users from Hans-Joachim Leidinger <jojo@buchonline.net>     ******

I finally got it.  I removed the single quotes around the var1 and var2 inside
the perl code.  Added another scratch variable that indicates whether the
condition is true or false.  Then below the perl code did another test to
determine if the sql is executed.
Thanks
 Karl
Here it is.
[set name="var1" interpolate=1][value pass_var1][/set]
[set name="var2" interpolate=1][value pass_var2][/set]
[set name="var3"]No][/set]
[perl arg=scratch]
           $a = $Safe{'scratch'}->{var1};
           $b = $Safe{'scratch'}->{var2};
           if ($a eq $b) {
      	   $Safe{'scratch'}->{var3}="Yes";
          }
[/perl]

[if scratch var3 eq 'Yes']
           [sql type=set interpolate=1]
                          update recotable_tbl set var1=[scratch var1] where trim(recoid) ='[value pass_recoid]' 
            [/sql]
[/if]

> > How about
> > 
> > [set name="var1" interpolate=1][value pass_var1][/set]
> > [set name="var2" interpolate=1][value pass_var2][/set]
> > 
> > [perl arg=scratch]
> >           $a = $Safe{'scratch'}->'{var1}';
> >           $b = $Safe{'scratch'}->'{var2}';
> >           if ($a eq $b) {
> >                  [sql type=set interpolate=1]
> >                          update recotable_tbl set var1=[scratch var1]
> > where trim(recoid) ='[value pass_recoid]'
> >                  [/sql]
> >                  return "Update was successful";
> >          } else {
> >                  return "Update was not successful";
> >             }
> > 
> > [/perl]
> > 
-
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: