>>>>LOCAL lnErrCnt >>>>WITH This >>>> *** How many Errors currently? >>>> lnErrCnt = ALEN( .AErrors, 1 ) >>>> *** If only one row, is it actually an error? >>>> IF lnErrCnt = 1 AND EMPTY( .Aerrors[ 1, 1 ] ) >>>> *** Nope - set error count = 1 >>>> lnErrCnt = 1 >>>> ELSE >>>> *** We already have at least one error, >>>> *** so increment the counter >>>> lnErrCnt = lnErrCnt + 1 >>>> ENDIF >>>> *** Re-Dimension the Collection >>>> DIMENSION .AErrors[ lnErrCnt, 5 ] >>>> *** And Populate the current row >>>> .AErrors[ lnErrCnt, 1 ] = tnErrNum >>>> .AErrors[ lnErrCnt, 2 ] = IIF( EMPTY( tcErrMsg) , "", ALLTRIM( tcErrMsg ) ) >>>> .AErrors[ lnErrCnt, 3 ] = IIF( EMPTY( tcMethod) , "", ALLTRIM( tcMethod ) ) >>>> .AErrors[ lnErrCnt, 4 ] = IIF( EMPTY( tnLineNum) , "", ALLTRIM( PADL( tnLineNum, 100 )) ) >>>> .AErrors[ lnErrCnt, 5 ] = IIF( EMPTY( tnSeverity) , "", ALLTRIM( PADL( tnSeverity, 100 )) ) >>>>ENDWITH >>>>*** Just Return Success! >>>>RETURN .T. >>>>>>>>
>>>>LOCAL lnErrCnt, loParamObj, lcErrName, lcErrDets, lnCnt >>>> >>>>*** Create the parameter object >>>>loParamObj = CREATEOBJECT( 'relation' ) >>>> >>>>*** Check if we have any errors >>>>lnErrCnt = ALEN( This.AErrors, 1 ) >>>>IF lnErrCnt = 1 AND EMPTY( This.AErrors[1,1] ) >>>> *** No Errors Pending >>>> loParamObj.AddProperty( 'nErrorCount', 0 ) >>>>ELSE >>>> *** Populate the Parameter Object here >>>> WITH loParamObj >>>> .AddProperty( 'nErrorCount', lnErrCnt ) >>>> .AddProperty( 'aErrors[1]', "" ) >>>> *** Now Get the 5 Logged Details >>>> FOR lnCnt = 1 TO lnErrCnt >>>> *** Add a row to the error array >>>> DIMENSION .aErrors[lnCnt, 5] >>>> *** Log the error as Character Strings >>>> .aErrors[lnCnt, 1] = TRANSFORM( This.AErrors[ lnCnt , 1] ) && Error Number >>>> .aErrors[lnCnt, 2] = TRANSFORM( This.AErrors[ lnCnt , 2] ) && Error Message >>>> .aErrors[lnCnt, 3] = TRANSFORM( This.AErrors[ lnCnt , 3] ) && Prog/Method >>>> .aErrors[lnCnt, 4] = TRANSFORM( This.AErrors[ lnCnt , 4] ) && Code Line >>>> .aErrors[lnCnt, 5] = TRANSFORM( This.AErrors[ lnCnt , 5] ) && Severity >>>> NEXT >>>> ENDWITH >>>>ENDIF >>>>*** Clear the Error Collection >>>>DIMENSION This.AErrors[1,5] >>>>This.AErrors = "" >>>>*** Return Errors >>>>RETURN loParamObj >>>>>>>>