If-Else statement with condition

(imported topic written by TLSM)

Hi All,

I would like to create a task that can change the primary relay server to accordingly relay server.

I have the action but I still need a condition If-Else statement.

If (Condition = IP contain of 10.0.10. AND Primary Relay server NOT EQUAL TO 10.0.10.15)

{

setting “__RelaySelect_Automatic”=“0” on “Wed, 26 Mar 2014 07:36:25 +0000” for client

setting “__RelayServer1”=“http%3a%2f%2f10%2e0%2e10%2e15%3a52311%2fbfmirror%2fdownloads%2f” on “Wed, 26 Mar 2014 07:36:25 +0000” for client

setting “__RelayServer2”=“http%3a%2f%2f10%2e0%2e10%2e15%3a52311%2fbfmirror%2fdownloads%2f” on “Wed, 26 Mar 2014 07:36:25 +0000” for client

} Else IF (Condition)

{

Action

}…

Can anyone help me to verify the condition?

I had try few but seem do not working.

I had 2 conditions needed:

  1. Contain IP 10.0.10. (Example)

  2. Primary relay Not Equal 10.0.10.15

Many thanks.

(imported comment written by jgstew)

Your syntax for IF statements in actionscript does not appear correct. There seems to be issues with the relevance as well.

if { (relevance) }

elseif { (relevance) }

endif

(imported comment written by TLSM)

Hi jgstew,

Thanks for your replied.

But it is possible that I match 2 condition into the relevance?

Because I wish to match the IP address segment (contain 10.0.10.) and Not match with the Relay server (Relay server != 10.0.10.15)

Relevance 1:

(
exists

true

whose
(
if

true

then
(
exists
(
if
(
exists

true

whose
(
if

true

then
(
exists
ip interfaces
of
network)
else

false
) )
then
addresses
whose
(
it

as
string
!=

“0.0.0.0”
)
of
ip interfaces
whose
(
not
loopback
of

it
)
of
network
as
string
else

nothing
)
whose
(
it

as
string
as
lowercase
contains

“10.0.10.”

as
lowercase))
else

false
))

Relevance 2:

(
exists

true

whose
(
if

true

then
(
not

exists
(
if
((
it

does not contain

“127.0.0.1”

and

it

does not contain

“::1”
)
of
name
of
registration server)
then
(name
of
registration server)
else

if
(
exists
setting
"_BESRelay_PostResults_ParentRelayURL"

of
client
and

exists
value
of
setting
"_BESRelay_PostResults_ParentRelayURL"

of
client
as
string)
then
(preceding text
of
first
"/"

of
(following text
of
first
"//"

of
(value
of
setting
"_BESRelay_PostResults_ParentRelayURL"

of
client)))
else

“BES Root Server”
)
whose
(
it

as
string
as
lowercase

“10.0.10.15”

as
lowercase))
else

false
))

Can we insert so long condition relevance into our task? or how should I shorten it and run the task?

Anyone can guide or advice me?

Thanks

(imported comment written by Tim.Rice)

Rather than creating a single Task to try and handle all the conditions, why not build the conditions into the Relevance for the Task itself?

That way you don’t need ANY if/then/else logic in the Action script at all. Just create as many Tasks as you need to cover all the conditions.

(imported comment written by jgstew)

You can have as many relevance statements combined as you want.

If{ ( (relevance1) AND (relevance2) ) OR relevance3 }

endif

Though, I do agree with Tim, that in most cases you should break up your tasks into smaller pieces that run separately when possible with the relevance required for each, then just take all of the actions simultaneously.

I am also wondering what you are trying to achieve, and if there might be an easier way to do it.

(imported comment written by JasonWalker)

I’m confused. Are you asking “What’s the syntax for an IF / ELSE / ENDIF Statement”, or are you asking “What inspectors can I use to retrieve my client’s IP address and the current registration server”?

(imported comment written by jgstew)

I wasn’t sure either. I think both are at issue.