icMessage | input | character | The actual message, can contain $1, $2, ... for values that are situation-dependent. |
icArguments | input | character | chr(2) seperated list of values to replace $1, $2, ... in the message with. These values should not be translatable. |
icFieldName | input | character | Optional name of a business field, to link the message to that field. |
icFieldValue | input | character | Optional value of the business field, converted to string type. |
icType | input | character | Type of message: E = user error (incorrect input, this type of error is linked to a business field) D = database error (other errors) S = system error (or programming error) W = warning, results in return status +1 (the transaction can still proceed) |
iiSeverity | input | integer | Error severity level (used to sort the messages on in the error viewer): 1 = critical 2 = high 3 = normal 4 = low |
icRowid | input | character | Optional rowid to link the message to a single record in the class temp-table (mentioned in parameter icFieldName). Refers to the field tc_Rowid. |
icFcMsgNumber | input | character | A unique number per CB project. DO NOT CHANGE THIS PARAMETER |
icFcExplanation | input | character | Long description, fully explaining what exactly caused the error or warning, and what has to be done to solve the error/warning involved. |
icFcIdentification | input | character | If the error is linked to a specific business object, this field should fully identify this object. The content of this field is considered to be untranslatable. |
icFcContext | input | character | Change the description of the icContext parameter of the SetMessage method. Here, the developer can pass extra context information to the end-user that can help him to understand why things went wrong. This field contains context information, like booleans, data items, result of buffer-compare. We advise to use the syntax "<Field>=<Value>chr(2)<Field>=<Value>...." as this is recognized by the error viewer. The content of this field is considered to be untranslatable. |
oiReturnStatus | output | integer |
/* replace the non-translatable arguments */ do viCnt = 1 to 9: if num-entries(icArguments,chr(2)) < viCnt or entry(viCnt,icArguments,chr(2)) = ? then assign icMessage = replace (icMessage, "$":U + string(viCnt), ""). else assign icMessage = replace (icMessage, "$":U + string(viCnt), entry(viCnt,icArguments,chr(2))). end. /* Replace some common used non-displayable characters */ icFcContext = replace (icFcContext,chr(2),chr(10)). icFcContext = replace (icFcContext,chr(3),chr(10)). icFcContext = replace (icFcContext,chr(4),chr(10)). icFcIdentification = replace (icFcIdentification,chr(2),chr(10)). icFcIdentification = replace (icFcIdentification,chr(3),chr(10)). icFcIdentification = replace (icFcIdentification,chr(4),chr(10)). icFieldValue = replace (icFieldValue,chr(2),chr(10)). icFieldValue = replace (icFieldValue,chr(3),chr(10)). icFieldValue = replace (icFieldValue,chr(4),chr(10)). icMessage = replace (icMessage,chr(2),chr(10)). icMessage = replace (icMessage,chr(3),chr(10)). icMessage = replace (icMessage,chr(4),chr(10)). /* Add user-friendly part to system errors */ if icType = "S":U then assign icMessage = trim (#T-1'An unexpected system error has occurred.':100(5167)T-1#) + " ":U + trim (#T-2'Please contact your system administrator.':255(54)T-2#) + chr(10) + icMessage. create tFcMessages. assign tFcMessages.tcFcMessage = trim(icMessage) tFcMessages.tcFcFieldName = icFieldName tFcMessages.tcFcFieldValue = icFieldValue tFcMessages.tcFcType = icType tFcMessages.tcFcRowid = (if icRowid = "" or icRowid = ? then " ":U else icRowid) /* No empty prime key allowed in a DataSet */ tFcMessages.tiFcSeverity = iiSeverity tFcMessages.tcFcMsgNumber = icFcMsgNumber tFcMessages.tcFcExplanation = icFcExplanation tFcMessages.tcFcIdentification = icFcIdentification tFcMessages.tcFcContext = icFcContext. viFcCount5 = 2. do while program-name(viFcCount5) begins "SetMessage ": viFcCount5 = viFcCount5 + 1. end. do while program-name(viFcCount5) <> ?: if num-entries(program-name(viFcCount5), " ") = 2 then if entry(2,program-name(viFcCount5), " ") begins "program" then if entry(2,program-name(viFcCount5), " ") begins "program/" then vcProc = entry(1,entry(2,entry(2,program-name(viFcCount5), " "), "/"), ".") + "." + entry(1,program-name(viFcCount5), " "). else vcProc = "". else vcProc = program-name(viFcCount5). else vcProc = program-name(viFcCount5). if vcProc <> "" then do: if tFcMessages.tcFcBusMethod = "" then tFcMessages.tcFcBusMethod = vcProc. else tFcMessages.tcFcBusMethod = tFcMessages.tcFcBusMethod + chr(10) + vcProc. if not session:error-stack-trace then leave. end. viFcCount5 = viFcCount5 + 1. end. /* This label is only in case the field cannot be found on the interface */ if icFieldName <> "":U and icFieldName <> ? and (search("appinfo/":U + lc(vcFcComponentName) + "_label.r":U) <> ? or search("appinfo/":U + lc(vcFcComponentName) + "_label.p":U) <> ?) then do: if icFieldName begins "t_s" then icFieldName = "t" + substring(icFieldName,4,-1,"CHARACTER"). run value ("appinfo/":U + lc(vcFcComponentName) + "_label.p":U) (input vhFcSuper, input icFieldName, output vcFcMaskList). /* common mistake in business field name : forget the leading 't' */ if vcFcMaskList = "" then do: run value ("appinfo/":U + lc(vcFcComponentName) + "_label.p":U) (input vhFcSuper, input "t":U + icFieldName, output vcFcMaskList). if vcFcMaskList <> "" then assign icFieldName = "t":U + icFieldName. end. assign tFcMessages.tcFcFieldLabel = vcFcMaskList. tFcMessages.tcFcFieldName = icFieldName. end. release tFcMessages.