Complex Expression In Until Condition

Technical support and scripting issues

Moderators: JRL, Dorian (MJT support)

Post Reply
mheptinstall
Newbie
Posts: 3
Joined: Mon Nov 25, 2013 10:28 am

Complex Expression In Until Condition

Post by mheptinstall » Tue Feb 17, 2015 2:00 pm

I am having problems getting a complex expression to work in a repeat/until loop. When looking at the Repeat help topic it states that Until can take a simple or complex expression, whereas the Until help topic only mentions simple expressions. I am using Macro Scheduler Pro 14.2.02.

GetExecution gets data from a database and returns an array in the format:

ExecutionResult_1_DataExtractName
ExecutionResult_1_ExecutionId
ExecutionResult_1_ParameterName
ExecutionResult_1_ParameterValue
ExecutionResult_1_UnitCode

FindParameter performs a loop over the returned array to find the appropriate value so it can be stored in its own variable for use later.

When I execute this I get the following error, any suggestions?

Code: Select all

Line: 36 - Repeat>{(%FoundParameter%="Yes") Or (%c%=%NumColumns%)} Not Found!

Code: Select all

Let>ConnectionString=someConnectionString

SRT>GetExecution
    // Create SQL statement to execute
    If>GetExecution_Var_1=
        Let>SQL=EXEC MacroScheduler.Execution_Get
    Else
        Let>SQL=EXEC MacroScheduler.Execution_Get @UnitCode='%GetExecution_Var_1%'
    EndIf
    
    // Connect to database
    Assigned>StagingOleDb,VariableAssigned
    If>VariableAssigned=FALSE
        DBConnect>ConnectionString,StagingOleDb
    EndIf
        
    // Execute SQL
    DBQuery>StagingOleDb,SQL,ExecutionResult,NumRows,NumColumns,1
    
END>GetExecution


SRT>FindParameter
    Let>r=0
    Let>FoundParameter=No
    Repeat>r
        Let>r=r+1
        Let>c=0
        Repeat>c
            Let>c=c+1
            Let>ParameterName=ExecutionResult_%r%_ParameterName
            If>ParameterName=FindParameter_Var_1
                Let>ParameterValue=ExecutionResult_%r%_ParameterValue
                Let>FoundParameter=Yes
            EndIf
        Until>{(%FoundParameter%="Yes") Or (%c%=%NumColumns%)}
    Until>{(%FoundParameter%="Yes") Or (%r%=%NumRows%)}  
END>FindParameter


GoSub>GetExecution

GoSub>FindParameter,Unit
If>FoundParameter=Yes
    Let>Unit=ParameterValue
EndIf

GoSub>FindParameter,StartDate
If>FoundParameter=Yes
    Let>StartDate=ParameterValue
EndIf

mheptinstall
Newbie
Posts: 3
Joined: Mon Nov 25, 2013 10:28 am

Re: Complex Expression In Until Condition

Post by mheptinstall » Tue Feb 17, 2015 3:48 pm

I changed the sub-routine to use a While loop instead and this works fine, so I guess Repeat/Until does not support complex expressions?

Post Reply
Sign up to our newsletter for free automation tips, tricks & discounts