The if statement

The if statement performs an action if a particular condition is satisfied.

The if statement takes the following format.

if( conditional_test )
        {
            List of stitcher rules to execute if the condition is TRUE
        }

The list of stitcher rules are executed if the conditional test is satisfied. It is also possible to specify a list of stitcher rules to execute if the condition is not satisfied, as shown below.

if( conditional_test )
        {
            List of stitcher rules to execute if the condition is TRUE
        }
else
        {
            List of stitcher rules to execute if the condition is FALSE
        }
Note that the if statement also supports the following:
  • The if statement also supports else if clauses.
  • The conditional_test can contain boolean expressions containing AND and OR.

Example

The following example shows the if statement in use. If myVariable is equal to 1, the first OQL statement is executed, otherwise the second OQL statement is executed.

if( myvariable == 1 )
        {
            ExecuteOQL
                (
                    "insert into database.table
                    (             m_Name,
                                  m_BaseName   )
                    values
                    (            "Agent",
                    (            "BaseName"   );"
                );
        }
else
        {
            ExecuteOQL
                (
                    "insert into another.table
                    (             m_Name,
                                  m_BaseName   )
                    values
                    (            "Agent",           "BaseName"   );"
                );
        }