# syntax problem? - Hewlett Packard

This is a discussion on syntax problem? - Hewlett Packard ; hi all i have the following script which is not working like it should. the second IF statement seems to be true always even if Rl is equal 0: { "Ue:" "Value of Ue in Volt" 0 } { "R1:" ...

# Thread: syntax problem?

1. ## syntax problem?

hi all

i have the following script which is not working like it should.
the second IF statement seems to be true always even if Rl is equal 0:

<< "Voltage Divider" {
{ "Ue:" "Value of Ue in Volt" 0 }
{ "R1:" "Value of R1 in Ohm" 0 }
{ "R2:" "Value of R2 in Ohm" 0 }
{ "Rl:" "Value of Rl in Ohm" 0 }
}
{ }
{ 0 0 0 0 }
{ 0 0 0 0 }
INFORM
IF THEN OBJ-> -> Ue R1 R2 Rl
<< IF 'Rl>0' THEN
'Ue * ( ( (R2 * Rl) / (R2 + Rl) ) / ( R1 + ( (R2 * Rl) / (R2 + Rl) )
)' ->NUM "Voltage of Ua is" ->TAG ->STR MSGBOX
ELSE 'Ue * ( R2 / (R1 + R2) )' ->NUM Voltage of Ua is" ->TAG ->STR MSGBOX
END
>>

ELSE END
>>

maybe a stupid newbie mistake. any ideas?

thanks a lot
p.

2. ## Re: syntax problem?

> << "Voltage Divider" {
> { "Ue:" "Value of Ue in Volt" 0 }
> { "R1:" "Value of R1 in Ohm" 0 }
> { "R2:" "Value of R2 in Ohm" 0 }
> { "Rl:" "Value of Rl in Ohm" 0 }
> }
> { }
> { 0 0 0 0 }
> { 0 0 0 0 }
> INFORM
> IF THEN OBJ->

Clue :
at this point you get more than just Ue, R1, R2 and Rl on the
stack

> -> Ue R1 R2 Rl

but here you seam to assume only Ue, R1, R2 and Rl

--
manjo
http://fly.srk.fer.hr/~manjo/openfire
| 49G+ | ROM 2.09 | hw serial:CN40213309 | sw serial:CN40701165 |

3. ## Re: syntax problem?

In article ,
"manjo" wrote:

> > << "Voltage Divider" {
> > { "Ue:" "Value of Ue in Volt" 0 }
> > { "R1:" "Value of R1 in Ohm" 0 }
> > { "R2:" "Value of R2 in Ohm" 0 }
> > { "Rl:" "Value of Rl in Ohm" 0 }
> > }
> > { }
> > { 0 0 0 0 }
> > { 0 0 0 0 }
> > INFORM
> > IF THEN OBJ->

>
> Clue :
> at this point you get more than just Ue, R1, R2 and Rl on the
> stack
>
> > -> Ue R1 R2 Rl

>
> but here you seam to assume only Ue, R1, R2 and Rl

Try following the OBJ-> command with a DROP

or replacing the OBJ-> with EVAL.

4. ## Re: syntax problem?

i got it to work - i didn't realize that cannot simply ignore the
element count in the stack...

Thanks to all for the quick assistance!
p.

Virgil wrote:
> In article ,
> "manjo" wrote:
>
>>> << "Voltage Divider" {
>>> { "Ue:" "Value of Ue in Volt" 0 }
>>> { "R1:" "Value of R1 in Ohm" 0 }
>>> { "R2:" "Value of R2 in Ohm" 0 }
>>> { "Rl:" "Value of Rl in Ohm" 0 }
>>> }
>>> { }
>>> { 0 0 0 0 }
>>> { 0 0 0 0 }
>>> INFORM
>>> IF THEN OBJ->

>> Clue :
>> at this point you get more than just Ue, R1, R2 and Rl on the
>> stack
>>
>>> -> Ue R1 R2 Rl

>> but here you seam to assume only Ue, R1, R2 and Rl

>
> Try following the OBJ-> command with a DROP
>
> or replacing the OBJ-> with EVAL.