Whenever you make a call to Bank Wizard, any number of fatal, error, warning and information conditions can be returned. You can either iterate through the conditions or search for a specific condition.
To deal with all the conditions, loop through the returned conditions by determining if there is another value and then, if there is, accessing that value.
You use BWINext to perform iteration.
This example shows how to loop through all of the errors that have resulted from a validation.
/* Assume 'h' has performed a validation */ while (BWINext(h,BWI_N_ERROR) { BWIGetValue(h,BWI_V_NEXT,value) BWIGetString(h,BWI_V_NEXT,string) print("Error (" + value + ") " + string) } |
When you call BWINext, pass the item BWI_V_NEXT. This tells it to check for the existence of the first or subsequent error. If an error exists, then call BWIGetValue and pass the item BWI_V_NEXT to return the relevant condition code. Call BWIString in the same way to request the error description.
There are four severities that BWINext can iterate through; BWI_N_FATAL, BWI_N_ERROR, BWI_N_WARNING and BWI_N_INFORMATION.
To display all the conditions for all severities:
for(type = BWI_N_FATAL; type = BWI_N_INFORMATION; type = type + 1) { while(BWINext(h,type) { BWIGetValue(h,BWI_V_NEXT,value) BWIGetString(h,BWI_V_NEXT,string) print(type + " (" + value + ") " + string) } } |
As well as iterating through to find all returned conditions, you can also check for a specific condition using BWIIsCondSet.
if(BWIIsCondSet(h,BWI_N_WARNING,BWG_W_TRANSPOSED)) { /* Handle transposed account details returned by Bank Wizard */ } |