[Date Prev][Date Next][Thread Prev][Thread Next][Minivend by date
][Minivend by thread
]
Re: [mv] Problem with [calc] and [scratch] variables
****** message to minivend-users from jojo@buchonline.net ******
On 14 Jul, Ramsey French wrote:
> ****** message to minivend-users from Ramsey French <rammjet@mac.com> ******
>
> Dear List,
>
> I have looked in the list archives and cannot resolve this problem.
>
> When I [calc] two [scratch] variables and place the result into a [scratch]
> variable, an extra space or unprintable character ends up prepended to the
> final [scratch] variable. This presents a problem when testing with [if] or
> using it as a key for searching in a table.
>
> Here are examples of my tests:
>
> This works:
> [if type=data term="frames::subcat_name::13"]
>
> This works:
> [set my_test]13[/set]
> [if type=data term="frames::subcat_name::[scratch my_test]"]
>
> This works:
> [seti my_test][calc]10+3[/calc][/seti]
> [if type=data term="frames::subcat_name::[scratch my_test]"]
>
> This FAILS:
> [set my_var1]10[/set]
> [set my_var2]3[/set]
> [seti my_test]
> [calc][scratch my_var1]+[scratch my_var2][/calc]
> [/seti]
> [if type=data term="frames::subcat_name::[scratch my_test]"]
>
>
> Looking closer:
>
> Placing this into HTML:
> [seti my_test][calc]10+3[/calc][/seti]
> this_has_no_space=[scratch my_test]
>
> yields
> this_has_no_space=13
>
> However, putting this in HTML:
> [set my_var1]10[/set]
> [set my_var2]3[/set]
> [seti my_test]
> [calc][scratch my_var1]+[scratch my_var2][/calc]
> [/seti]
> [seti my_test2]
> [[calc]return'[scratch my_var1]+[scratch my_var2]'[/calc]]
> [/seti]
> this_has_a_space=[scratch my_test]
> what_have_we_here=[scratch my_test2]
>
> yields:
> this_has_a_space= 13
> what_have_we_here= [10+3]
> (notice a space between "=" and "13" and "[10+3]")
>
>
> Any suggestions?
Try
[perl arg=scratch]
$Safe{'scratch'}{'var1'} = 10;
$Safe{'scratch'}{'var2'} = 3;
$_ = $Safe{'scratch'}{'var1'} + $Safe{'scratch'}{'var2'};
$Safe{'scratch'}{'out'} = $_;
return '';
[/perl]
<BR><BR>
test out=[scratch out]
Joachim
--
Hans-Joachim Leidinger
buch online jojo@buchonline.net
Munscheidstr. 14 FAX: +49 209 1671449
45886 Gelsenkirchen FAX: 0209 1671449
-
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