When ArrayLen is called with an element that is null, it throws an error. How do you make it return 0?
The value '' cannot be converted to a number.
The error occurred in D:/Resource/WWW/DEV/ww1dev.cwtvacations.com/welcome_survey/welcome_survey_question_builder.cfm: line 12
10 : <cfset curPage = SESSION.thisPage />
11 :
12 : <cfloop from="1" to="#ArrayLen(SESSION.WHSurveyStruct.pagesQuestions[curPage])#" index="curQuestion">
13 : <cfif (SESSION.WHSurveyStruct.pagesQuestions[curPage][curQuestion].SectionID eq 4 AND SESSION.WHSurveyStruct.AirlineID neq 0) <!--- Ask airline questions, if airline known --->
14 : OR (SESSION.WHSurveyStruct.pagesQuestions[curPage][curQuestion].SectionID neq 4
There is a couple things you can do. You can use a ternary operator and assign the whole thing to a variable:
upperBound = isNull(SESSION.WHSurveyStruct.pagesQuestions[curPage]) ? 0 : ArrayLen(SESSION.WHSurveyStruct.pagesQuestions[curPage]);Or you can check it before hand. However, it appeared odd that you are specifying a specific element of an array as the array. i.e.
SESSION.WHSurveyStruct.pagesQuestions[curPage]doespagesQuestions[]contain the array or is it the array? If it is the array, remove the[curParge]index.