PDA

View Full Version : how to compare two variables



NewsArchive
11-30-2007, 10:50 AM
I am just starting to look at SB and I can't seem to find a way to
compare two variables e.g. If %VAR1% Equals %VAR2% Then do something

It only seems to allow me to compare a variable to a constant.

tia

Parker

NewsArchive
11-30-2007, 10:51 AM
> I am just starting to look at SB and I can't seem to find a way to
> compare two variables e.g. If %VAR1% Equals %VAR2% Then do something
>
> It only seems to allow me to compare a variable to a constant.

Parker,

Just use the standard IF statement in the script editor.

You say IF %VAR1% EQUALS %VAR2% (you select %VAR1% from the list and type
in the %VAR2% in the field where you would put the constant).

Does that help?


Charles




--
-------------------------------------------------------------------------------------------------------
Charles Edmonds

www.clarionproseries.com - "Serious imaging tools for Clarion Developers"
www.ezround.com - "Round Corner HTML tables with matching Banners, Buttons
and Forms!"
www.lansrad.com - "Intelligent Solutions for Universal Problems"
www.fotokiss.com - "World's Best Auction Photo Editor"
-------------------------------------------------------------------------------------------------------

NewsArchive
11-30-2007, 10:52 AM
Parker,

>I am just starting to look at SB and I can't seem to find a way to compare
>two variables e.g. If %VAR1% Equals %VAR2% Then do something
>
> It only seems to allow me to compare a variable to a constant.

Exactly what Charles said. Just use the If... statement to implement a
conditional statement. You can compare against runtime variables,
constants, runtime variables, and absolute values.

The following conditions are supported by default:

Condition

- Equals, Not Equal-The value of the variable must or must not equal the
value given in the field.

- Equals (Ignore Case), Not Equal (Ignore Case)-The value of the variable
must or must not equal the value given in the field. The case of the value
is ignored.

- Greater Than, Greater Than or Equal To-The value of the variable must be
greater than or equal to the value given.

- Less Than, Less Than or Equal To-The value of the variable must be less
than or equal to the value given.

- Contains Any Letters In-At least one of the letters in the variable must
be found in the value given in the field. This comparison and the next one
are useful for testing the results of dialogs containing radio buttons, list
boxes, or checkboxes, which return letters to indicate which options the
user selected.

- Contains Letters Not In-At least one of the letters in the variable must
not be found in the value given in the Value field.

- Contains, Does Not Contain-The value of the variable must (or must not)
contain the text given in the Value field.

- Length Equal To-The length of the text in the variable must equal the
value given below.

- Length Not Equal To-The length of the text in the variable must not equal
the value given below.

- Bitwise AND-Returns the bitwise AND of the two expressions. Expression1
AND Expression2. Both expressions must be absolute immediate values.

- Equals "1" on Position Value-Evaluates to TRUE if a value equals "1" on
Position Value.

- Not Equals "1" on Position Value-Evaluates to FALSE if a value equals "1"
on Position Value.

- Version Equals, Version Not Equal-The version of variable is equal or not
equal to the value given.

- Version Less-The version of variable must be less than the value given.

- Version Greater-The version of variable must be greater than the value
given.

HTH,

--
Friedrich Linder
Lindersoft
www.lindersoft.com
+1.954.252.3910

"point. click. ship" - that's SetupBuilder 6.6
Create Windows Vista ready installations in minutes

-- Official Comodo Code Signing and SSL Certificate Partner

NewsArchive
12-03-2007, 02:56 AM
> Parker,
>
> Just use the standard IF statement in the script editor.
>
> You say IF %VAR1% EQUALS %VAR2% (you select %VAR1% from the list and type
> in the %VAR2% in the field where you would put the constant).
>
> Does that help?
>
Charles:

When I do that it looks like this in the script editor:

If %VAR1% Greater Than "%VAR2%" Then

With the quotes in there isn't that checking to see if VAR1 is equal to
the constant %VAR2% not the value of %VAR2% ?

I'll try it and see what happens.

Thanks

Parker

NewsArchive
12-03-2007, 02:57 AM
> Parker,
>
> Just use the standard IF statement in the script editor.
>
> You say IF %VAR1% EQUALS %VAR2% (you select %VAR1% from the list and type
> in the %VAR2% in the field where you would put the constant).
>
> Does that help?
>
Charles:

Yup, that seems to do the trick, sorry for being so dense.

Thanks again.

Parker

NewsArchive
12-03-2007, 02:58 AM
> Yup, that seems to do the trick, sorry for being so dense.

Glad to help.

Your doing fine - some of this just takes a bit getting used to.

;-)

Charles


--
-------------------------------------------------------------------------------------------------------
Charles Edmonds

www.clarionproseries.com - "Serious imaging tools for Clarion Developers"
www.ezround.com - "Round Corner HTML tables with matching Banners, Buttons
and Forms!"
www.lansrad.com - "Intelligent Solutions for Universal Problems"
www.fotokiss.com - "World's Best Auction Photo Editor"
-------------------------------------------------------------------------------------------------------