ajRaiseError function
Description
The ajRaiseError function adds an error element into the Model Error List. This function is normally used together with the Excel "IF" statement and ajModelError function.
Syntax
ajRaiseError(error_message, [error_code] , [cell_reference] , [run_condition], [run_by_function_point_only])
Argument Name | Argument Type | Description |
---|---|---|
error_message (required) | String | The error message of a record to be added to the model error list. |
error_code (optional) | String | The error code of a record to be added to the model error list. The default value is an empty string (“”). |
cell_reference (optional) | String | The cell address that produces this error. The default value is the cell this function is in. If another cell address is used, it is recommended to use ajAddress to specify the address. |
run_condition (optional) | Boolean | The function will run when the value is TRUE. Otherwise, it will not run. The default value is TRUE. |
run_by_function_point_only (optional) | Boolean | If it equals FALSE, the function can be executed through ‘Excel Calculation’ (can be either Automatic or Manual, Calculate Now or Calculate Sheet) or Preview Function Point. If it equals TRUE, the function can be executed with Preview Function Point (AlchemyJ ribbon \ Preview Function Point) only. The default value is TRUE. |
The function will return:
1) Return Value: TRUE / #VALUE!
2) Return Type: Single Value
Example
The below example adds an error with the information specified in cell B1, B2, B3 to the Model Error List.
This function returns TRUE if the exception has been successfully added to the list. Otherwise, it will return #VALUE!.
After a function point is run in AlchemyJ Studio, it pops up a message to show all the errors on the Model Error List and System Error List. Both error lists are at the function point level. They reset every time a function point is run.
Click here to download the use case workbooks for further reference.
Error Scenarios
System will raise error when missing any required parameter or invalid data type was inputted.