Increment counter

Comments

3 comments

  • Avatar
    juanjo

    you can just use:

    <setInstallerVariable>
        <name>loop_minutes</name>
        <value>0</value>
    </setInstallerVariable>
    <mathExpression>
        <text>${loop_minutes}+1</text>
        <variable>loop_minutes</variable>
    </mathExpression>
    
  • Avatar
    GSimpson

    The error that I am getting is the following:
    Error executing action {mathExpression}:
    Error in math expression

    Since there is only 1 mathExpression in the entire installer, it is obvious that this is it. So, how do I increment "loop_minutes"?

    The code that I am using is:

    <while>
    <actionList>
        <mathExpression>
            <text>${loop_minutes}+1</text>
            <variable>loop_minutes</variable>
        </mathExpression>
        <if>
            <actionList>
                <addTextToFile>
                    <file>${prefix}/backup/dailybackup.sql</file>
                    <text>t,</text>
                </addTextToFile>
            </actionList>
            <conditionRuleList>
                <compareValues>
                    <logic>equals</logic>
                    <value1>${dailystartmin}</value1>
                    <value2>${loop_minutes}</value2>
                </compareValues>
            </conditionRuleList>
            <elseActionList>
                <addTextToFile>
                    <file>${prefix}/backup/dailybackup.sql</file>
                    <text>f,</text>
                </addTextToFile>
            </elseActionList>
        </if>
    </actionList>
    <conditionRuleList>
        <compareValues>
            <logic>less</logic>
            <value1>${minutes}</value1>
            <value2>60</value2>
        </compareValues>
    </conditionRuleList>
    
    </while>
  • Avatar
    GSimpson

    I think I see something here... It would make sense, kind of... The following are debugger log files.

    This is where I set the variables.

    No rules provided, returning 'true'
    Rules match
    Action <setInstallerVariable> was properly executed
    Considering <setInstallerVariable> action
    Properties of element <setInstallerVariable>:
    <abortOnError> : "1" -> "1"
    <breakpoint> : "0" -> "0"
    <customErrorMessage> : "" -> ""
    <explanation> : "" -> ""
    <name> : "${loop_minutes}" -> "***unknown variable loop_minutes***"
    <persist> : "0" -> "0"
    <progressText> : "" -> ""
    <ruleEvaluationLogic> : "and" -> "and"
    <run> : "1" -> "1"
    <show> : "1" -> "1"
    <showMessageOnError> : "1" -> "1"
    <value> : "0" -> "0"
    

    Here is where the variables get manipulated...

    Evaluating rule <compareValues>
    Result is '1'
    No more rules to execute
    Rules are true
    Executing <actionList>
    Considering <mathExpression> action
    Properties of element <mathExpression>:
    <abortOnError> : "1" -> "1"
    <breakpoint> : "0" -> "0"
    <customErrorMessage> : "" -> ""
    <explanation> : "" -> ""
    <progressText> : "" -> ""
    <ruleEvaluationLogic> : "and" -> "and"
    <run> : "1" -> "1"
    <show> : "1" -> "1"
    <showMessageOnError> : "1" -> "1"
    <text> : "${loop_minutes}+1" -> "***unknown variable loop_minutes***+1"
    <variable> : "loop_minutes" -> "loop_minutes"
    Rules are true
    Executing <actionList>
    Considering <mathExpression> action
    Properties of element <mathExpression>:
    <abortOnError> : "1" -> "1"
    <breakpoint> : "0" -> "0"
    <customErrorMessage> : "" -> ""
    <explanation> : "" -> ""
    <progressText> : "" -> ""
    <ruleEvaluationLogic> : "and" -> "and"
    <run> : "1" -> "1"
    <show> : "1" -> "1"
    <showMessageOnError> : "1" -> "1"
    <text> : "${loop_minutes}+1" -> "***unknown variable loop_minutes***+1"
    <variable> : "loop_minutes" -> "loop_minutes"
    

    Now, the question becomes, What is an unknown variable and why is it messing with me? :)

Please sign in to leave a comment.