[Date Prev][Date Next][Thread Prev][Thread Next][Interchange by date
][Interchange by thread
]
Re: [ic] problem with perl
:o(( my result = Test and Out blanck, nothing, nada !!??
[seti tva][data table="tva" column="taux" key="[item-field Cat_tva]"][/seti]
[seti subtotalvar][item-subtotal noformat=1][/seti]
[perl interpolate=1 arg='scratch values']
my a$;
my b$;
$Safe{'scratch'}->{'var1'} = $Safe{'scratch'}->{'tva'};
$Safe{'scratch'}->{'var2'} = $Safe{'scratch'}->{'subtotalvar'};
$a = $Safe{'scratch'}->{'var1'};
$b = ($Safe{'scratch'}->{'var2'} * $Safe{'scratch'}->{'var1'});
$Safe{'scratch'}->{'test'} = $a;
$Safe{'scratch'}->{'out'} = $b;
return '';
[/perl]
tva : 0.196 ([scratch tva])
subtotalvar : 2500 ([scratch subtotalvar])
test : ([scratch test])
out : ([scratch out])
Thanks for your help
----- Original Message -----
From: Hans Joachim Leidinger <hans-joachim.leidinger@home.gelsen-net.de>
To: <interchange-users@lists.akopia.com>
Sent: Thursday, January 18, 2001 8:55 PM
Subject: Re: [ic] problem with perl
> Murray Gibbins wrote:
> >
> > ACC&S wrote:
> > >
> > > hi,
> > >
> > > I don't know PERL language, could you help me :
> > >
> > > my scratch variable tva = .196 and [item-subtotal noformat=1] = 2500,
then
> > > my result is :
> > > test : [scratch test] = 0
> > > res : [scratch out] = 0
> > >
> > > if i put $Safe{'scratch'}->{'var1'} = 196 / 1000 ; then my result
is OK
> > > test : [scratch test] = 0,196
> > > res : [scratch out] = 490
> > >
> > > this is my code :
> > > [perl interpolate=1 arg='scratch values']
> > > $Safe{'scratch'}->{'var1'} = '[scratch tva]';
> > > $Safe{'scratch'}->{'var2'} = '[item-subtotal noformat=1]';
> > > $_1 = $Safe{'scratch'}{'var1'};
> > > $_= ($Safe{'scratch'}{'var2'} * $Safe{'scratch'}{'var1'}) ;
> > > $Safe{'scratch'}{'test'} = $_1;
> > > $Safe{'scratch'}{'out'} = $_;
> > > return '';
> > > [/perl]
> > >
> > > Could you help to do the same thing with [scratch tva]
> > > thanks
> >
> > ok try this
> >
> > --------------------------
> >
> > [set tmp_val][item-subtotal noformat=1][/set]
> > [perl global=1]
> >
> >
> > ! exists $Scratch->{tmp_val} ? die "no tmp_val":1;
> > ! defined $Scratch->{tmp_val} ? die "no defined tmp_val":1;
> >
> > ! exists $Scratch->{tva} ? die "no tva":1;
> > ! defined $Scratch->{tva} ? die "no defined tva":1;
> >
> >
> > eval{$Scratch->{test} = $Scratch->{tva} * $Scratch->{tmp_val}
;};
> > if($@){
> > $Scratch->{test} = "Opps";
> > }
> > return ;
> > [/per]
> > Return value : '[scratch test]'
> >
> > ---------------------------
> >
> > It's must be fun tryng to use interchange without knowing perl ;-)
> >
> > Remember perldoc is your friend.
>
>
> Or try
>
> [seti subtotalvar][item-subtotal noformat=1][/seti]
> [perl interpolate=1 arg='scratch values']
> my a$;
> my b$;
> $Safe{'scratch'}->{'var1'} = $Safe{'scratch'}->{'tva'};
> $Safe{'scratch'}->{'var2'} =
> $Safe{'scratch'}->{'subtotalvar'};
> $a = $Safe{'scratch'}->{'var1'};
> $b = ($Safe{'scratch'}->{'var2'} * $Safe{'scratch'}->{'var1'})
> ;
> $Safe{'scratch'}->{'test'} = $a;
> $Safe{'scratch'}->{'out'} = $b;
> return '';
> [/perl]
>
> A perl newbie too!
>
> Joachim
> --
> -------------<FreeBsd>--------------------------------------------------
> Hans-Joachim Leidinger email: hans-joachim.leidinger@home.gelsen-net.de
> FAX : +49 0209-398265
>
> _______________________________________________
> Interchange-users mailing list
> Interchange-users@lists.akopia.com
> http://lists.akopia.com/mailman/listinfo/interchange-users
>
_______________________________________________
Interchange-users mailing list
Interchange-users@lists.akopia.com
http://lists.akopia.com/mailman/listinfo/interchange-users