I am trying to build a program which displays a list of supervisor's employee's. Each employee has three fields: current status, total hours, and total amount($).
I have a query called QempList which selects the employee for each supervior selected. So, if I had two employees under me, the QempList query would return 2 records.
I have built the following code to run each time a supervisor accesses this portion of the form:
<CFSET TDArr = ArrayNew(1)>
<CFLOOP FROM="1" TO="#qEmpList.RecordCount#" INDEX=i>
<CFSET TDArr = StructNew()>
<!--- Get Status --->
<CFSET TDArr.STATUS = qStat.STATUS>
<CFSET TDArr.TOTALHOURS = qPerTotals.TOTALHOURS>
<CFSET TDArr.TOTALAMOUNT = qPerTotals.TOTALAMOUNT>
</CFLOOP>
The problem I have is that every time this is run I get an error if one of the fields are empty. For example, if there are currently no hours, I get an error which says "The element at position 2 in dimension 1 of object "qPerTotals.TOTALHOURS" cannot be found. That dimension of the object is empty. Please, modify the index expression."
I tried an IsDefined and that didn't solve the problem. Any tips on how to resolve this problem?
I have a query called QempList which selects the employee for each supervior selected. So, if I had two employees under me, the QempList query would return 2 records.
I have built the following code to run each time a supervisor accesses this portion of the form:
<CFSET TDArr = ArrayNew(1)>
<CFLOOP FROM="1" TO="#qEmpList.RecordCount#" INDEX=i>
<CFSET TDArr = StructNew()>
<!--- Get Status --->
<CFSET TDArr.STATUS = qStat.STATUS>
<CFSET TDArr.TOTALHOURS = qPerTotals.TOTALHOURS>
<CFSET TDArr.TOTALAMOUNT = qPerTotals.TOTALAMOUNT>
</CFLOOP>
The problem I have is that every time this is run I get an error if one of the fields are empty. For example, if there are currently no hours, I get an error which says "The element at position 2 in dimension 1 of object "qPerTotals.TOTALHOURS" cannot be found. That dimension of the object is empty. Please, modify the index expression."
I tried an IsDefined and that didn't solve the problem. Any tips on how to resolve this problem?