It works if I use the "transactions" array provided by you so that means there is something wrong with the input data which is causing <foreach> to skip. However it is still not clear what is wrong with the Array data.
In the same code I have added below debug statements.
Now I can see that the "subArray" element has data still <foreach> is not getting executed.
Do you see anything wrong with the Array content that could cause <foreach> to not execute?
Code: Select all
<block name="sayTransactions" cond="index < transactions.length">
<assign name="subArray" expr="transactions[index]"/>
<if cond="debug">
<assign name="subArray" expr="transactions[0]"/>
<log expr="'**** sayTransactions Start - Index = '+index + ' Transactions Length = ' +transactions.length " />
<log expr="'**** sayTransactions Start - subArray length ' + subArray.length " />
<log expr="'**** Display 1st subArray:: ' + transactions[0]" />
<log expr="'**** 1st subArray 1st Element:: ' + subArray[0]" />
<log expr="'**** 1st subArray 2nd Element:: ' + subArray[1]" />
<log expr="'**** 1st subArray 3rd Element:: ' + subArray[1]" />
<log expr="'**** 1st subArray 4th Element:: ' + subArray[3]" />
<log expr="'**** 1st subArray 5th Element:: ' + subArray[4]" />
<log expr="'**** 1st subArray 1st Element contents:: ' + subArray[0].amount + ',' + subArray[0].date + ',' + subArray[0].day + ',' + subArray[0].type + ',' + subArray[0].description" />
<log expr="'**** 1st subArray 2nd Element contents:: ' + subArray[1].amount + ',' + subArray[1].date + ',' + subArray[1].day + ',' + subArray[1].type + ',' + subArray[1].description" />
<log expr="'**** 1st subArray 3rd Element contents:: ' + subArray[2].amount + ',' + subArray[2].date + ',' + subArray[2].day + ',' + subArray[2].type + ',' + subArray[2].description" />
<log expr="'**** 1st subArray 4th Element contents:: ' + subArray[3].amount + ',' + subArray[3].date + ',' + subArray[3].day + ',' + subArray[3].type + ',' + subArray[3].description" />
<log expr="'**** 1st subArray 5th Element contents:: ' + subArray[4].amount + ',' + subArray[4].date + ',' + subArray[4].day + ',' + subArray[4].type + ',' + subArray[4].description" />
<assign name="subArray" expr="transactions[1]"/>
<log expr="'**** Display 2nd subArray:: ' + transactions[1]" />
<log expr="'**** 2nd subArray 1st Element:: ' + subArray[0]" />
<log expr="'**** 2nd subArray 2nd Element:: ' + subArray[1]" />
<log expr="'**** 2nd subArray 3rd Element:: ' + subArray[1]" />
<log expr="'**** 2nd subArray 4th Element:: ' + subArray[3]" />
<log expr="'**** 2nd subArray 5th Element:: ' + subArray[4]" />
<log expr="'**** 2nd subArray 1st Element contents:: ' + subArray[0].amount + ',' + subArray[0].date + ',' + subArray[0].day + ',' + subArray[0].type + ',' + subArray[0].description" />
<log expr="'**** 2nd subArray 2nd Element contents:: ' + subArray[1].amount + ',' + subArray[1].date + ',' + subArray[1].day + ',' + subArray[1].type + ',' + subArray[1].description" />
<log expr="'**** 2nd subArray 3rd Element contents:: ' + subArray[2].amount + ',' + subArray[2].date + ',' + subArray[2].day + ',' + subArray[2].type + ',' + subArray[2].description" />
<log expr="'**** 2nd subArray 4th Element contents:: ' + subArray[3].amount + ',' + subArray[3].date + ',' + subArray[3].day + ',' + subArray[3].type + ',' + subArray[3].description" />
<log expr="'**** 2nd subArray 5th Element contents:: ' + subArray[4].amount + ',' + subArray[4].date + ',' + subArray[4].day + ',' + subArray[4].type + ',' + subArray[4].description" />
</if>
<if cond="index == 0">
<prompt cond="isCultureEnUS(language, locale)"> <audio expr="Prompt18"> <speak xml:lang="en-US"> <voice name="Jennifer"> <value expr="Verbiage18"/> </voice> </speak> </audio> </prompt>
<prompt cond="isCultureEsEs(language, locale)"> <audio expr="Prompt18"> <speak xml:lang="es-ES"> <voice name="Isabel"> <value expr="Verbiage18"/> </voice> </speak> </audio> </prompt>
<prompt cond="isCultureFrCa(language, locale)"> <audio expr="Prompt18"> <speak xml:lang="fr-CA"> <voice name="Julie"> <value expr="Verbiage18"/> </voice> </speak> </audio> </prompt>
</if>
<foreach item="tran" array="subArray">
<if cond="debug">
<log expr="'**** In inner foreach - amount'+index+' '+tran.amount" />
<log expr="'**** In inner foreach - date ' +index+' '+tran.date" />
<log expr="'**** In inner foreach - day ' +index+' '+tran.day" />
<log expr="'**** In inner foreach - type ' +index+' '+tran.type" />
In the logs below you can see that the subArray does has 5 elements and each element has the required fields namely amount, date,day,type & description. Therefore I am still confused why call is not entering the <foreach> loop
Code: Select all
Entering form = 'getTransactions' form item = '$_internalName_3810005'
LOCAL: *****In Get Transactions*****
Entering form = 'getTransactions' form item = '$_internalName_3810006'
LOCAL: **** #transactions 6
Entering form = 'getTransactions' form item = 'sayTransactions'
VXI::assign_element(name="subArray" expr = "transactions[index]")
VXI::assign_element(name="subArray" expr = "transactions[0]")
LOCAL: **** sayTransactions Start - Index = 0 Transactions Length = 6
LOCAL: **** sayTransactions Start - subArray length 5
LOCAL: **** Display 1st subArray:: [object Object],[object Object],[object Object],[object Object],[object Object]
LOCAL: **** 1st subArray 1st Element:: [object Object]
LOCAL: **** 1st subArray 2nd Element:: [object Object]
LOCAL: **** 1st subArray 3rd Element:: [object Object]
LOCAL: **** 1st subArray 4th Element:: [object Object]
LOCAL: **** 1st subArray 5th Element:: [object Object]
LOCAL: **** 1st subArray 1st Element contents:: 10,2016-08-01T18:00:00Z,undefined,CREDIT,Value Load
LOCAL: **** 1st subArray 2nd Element contents:: 10,2016-08-01T18:00:00Z,undefined,CREDIT,Value Load
LOCAL: **** 1st subArray 3rd Element contents:: 10,2016-08-01T18:00:00Z,undefined,CREDIT,Value Load
LOCAL: **** 1st subArray 4th Element contents:: 10,2016-08-01T18:00:00Z,undefined,CREDIT,Value Load
LOCAL: **** 1st subArray 5th Element contents:: 10,2016-08-01T18:00:00Z,undefined,CREDIT,Value Load
VXI::assign_element(name="subArray" expr = "transactions[1]")
LOCAL: **** Display 2nd subArray:: [object Object],[object Object],[object Object],[object Object],[object Object]
LOCAL: **** 2nd subArray 1st Element:: [object Object]
LOCAL: **** 2nd subArray 2nd Element:: [object Object]
LOCAL: **** 2nd subArray 3rd Element:: [object Object]
LOCAL: **** 2nd subArray 4th Element:: [object Object]
LOCAL: **** 2nd subArray 5th Element:: [object Object]
LOCAL: **** 2nd subArray 1st Element contents:: 10,2016-08-01T18:00:00Z,undefined,CREDIT,Value Load
LOCAL: **** 2nd subArray 2nd Element contents:: 10,2016-08-01T18:00:00Z,undefined,CREDIT,Value Load
LOCAL: **** 2nd subArray 3rd Element contents:: 10,2016-08-01T18:00:00Z,undefined,CREDIT,Value Load
LOCAL: **** 2nd subArray 4th Element contents:: 10,2016-08-01T18:00:00Z,undefined,CREDIT,Value Load
LOCAL: **** 2nd subArray 5th Element contents:: 10,2016-08-01T18:00:00Z,undefined,CREDIT,Value Load
bargein set to true
INPUTMODES set to "DTMF"
Cache Miss: http://ivrpv-vppp.blackhawk-net.com/BES/audio/en_us/Prompt18.wav
Attempting to fetch http://ivrpv-vppp.blackhawk-net.com/BES/audio/en_us/Prompt18.wav
HTTP/1.1 404 Not Found - http://ivrpv-vppp.blackhawk-net.com/BES/audio/en_us/Prompt18.wav
Audio segment from the URL http://ivrpv-vppp.blackhawk-net.com/BES/audio/en_us/Prompt18.wav added to prompt queue
Unrecognized format in pvxPromptConvertCopySource
Failure during pvxPromptConvertCopySource
bargein set to true
INPUTMODES set to "DTMF"
Audio segment added to prompt queue from TTS application/synthesis+ssml for:
---------
<?xml version='1.0'?><speak><voice gender="female"><speak xml:lang="en-US"><voice name="Jennifer"><speak> Your last five transactions were </speak></voice></speak></voice></speak>
---------
VXI::foreach_element()
LOCAL: **** sayTransactions End - Index = 0 Transactions Length = 6
VXI::assign_element(name="index" expr = "index + 1")
LOCAL: **** sayTransactions End - After Incrementing Index = 1 Transactions Length = 6
LOCAL: **** sayTransactions End - More Transactions Available
Entering form = 'getTransactions' form item = 'check'
VXI::queue_prompts()