We've Moved! Please visit our new and improved forum over at our new portal: https://portal.plumvoice.com/hc/en-us/community/topics

Invalid assignment left-hand side when increment variable

Questions and answers about IVR programming for Plum DEV

Moderators: admin, support

Post Reply
Sparker
Posts: 14
Joined: Tue Jan 27, 2015 10:48 am

Invalid assignment left-hand side when increment variable

Post by Sparker »

I am having difficulty incrementing a variable that I am using for a counter. My code is below. This particular form is reached via another form that is working well. When a user says 'No', I wish to increment the retry_Counter by 1 and go back to form SubIsAvailable. Once in SubIsAvailable, if my retry_Counter is still less than my try_Limit, I want to continue to ask for the correct person...and continue this loop until my limit is reached.

The error I'm receiving is:

invalid assignment left-hand side line 1
SyntaxError: invalid assignment left-hand side line 1

Is there something wrong with my "retry_Counter" or "try_Limit" variable names? I've declared them outside of any form in this way:
<var name="retry_Counter" expr="1" />
<var name="try_Limit" expr="6" />

thus, they should be accessible by any form on the page, correct?

Thanks for any help!

Code: Select all

  <form id="replayMsg">
        <field name="repSpeakingTo"> 
            <grammar src="builtin:grammar/boolean"/>
            <grammar src="builtin:dtmf/boolean" />
            <prompt>
                <audio expr="yesNoUrl">
                    For Yes, press 1 or Say Yes. For No, press 2 or Say No.
                </audio>
            </prompt>         
            <filled>
                <if cond="repSpeakingTo==1 || repSpeakingTo=='Yes' || repSpeakingTo='true' ">
                    <prompt>Continue survey.</prompt>
                <elseif cond="repSpeakingTo==0"  />
                    <assign name="retry_Counter" expr="retry_Counter+1" />
                    <prompt>Wait some more.</prompt>
                    <goto next="#SubIsAvailable" />
                </if>
            </filled>
        </field>
    </form>

    <form id="SubIsAvailable">
        <block>               
            <if cond="retry_Counter < try_Limit">
                <prompt>
                     <audio expr="waitForSub2Url">
                        OK. Please ask this person to come to the phone.
                        <break time="6s" />
                        Hello. This is the Center calling. Am I speaking to?
                    </audio>
                </prompt>
                <prompt>
                    <sentence><say-as type="name"><%=IVRCall.subName.ToString()%></say-as></sentence>
                </prompt>  
                <goto next="#replayMsg" />
            <else />
                <prompt>Exceeded try limit.</prompt>
         </if>       
        </block> 
    </form>


support
Posts: 3632
Joined: Mon Jun 02, 2003 3:47 pm
Location: Boston, MA
Contact:

Re: Invalid assignment left-hand side when increment variabl

Post by support »

Hi,

The issue you were experiencing was not actually related to the counters. You were properly handling those. Your line:

Code: Select all

<if cond="repSpeakingTo==1 || repSpeakingTo=='Yes' || repSpeakingTo='true' ">
is missing the second "=" for the "true" check. This is why you were receiving the error.


The boolean grammar will return a true or false value. You can actually simplify your if/else statements like this:

Code: Select all

<if cond="repSpeakingTo">
    <prompt>Continue survey.</prompt>
<else/>
    <assign name="retry_Counter" expr="retry_Counter+1" />
    <prompt>Wait some more.</prompt>
    <goto next="#SubIsAvailable" />
</if>
Hope this helps.

Regards,
Plum Support

Post Reply