project QadFinancials > class BFRWAnalysisCode > method ValidateComponentPostCalculationSplitEntities
Parameters
icCalculationText | input | character | |
icDelimiterChars | input | character | |
icRowId | input | character | |
ocCalculationPart1 | output | character | |
ocCalculationPart2 | output | character | |
ocCalculationPart3 | output | character | |
oiReturnStatus | output | integer | Return status of the method. |
Internal usage
QadFinancials
program code (program1/bfrwanalysiscode.p)
assign viMaxLength = 4
viRow = 1.
repeat:
assign viCounter = 1
viTop = 0.
repeat: /* find the first index of all the split characters in the source string. */
if viCounter = NUM-ENTRIES(icDelimiterChars) + 1
then leave.
assign vcCharacter = ENTRY(viCounter,icDelimiterChars,",")
viNext = INDEX(icCalculationText, vcCharacter).
if viNext > 0 and (viNext <= viTop or viTop = 0 )
then assign viTop = viNext.
assign viCounter = viCounter + 1.
end. /* repeat: find the first index of all the split characters in the source string. */
if viTop = 0 /*no found the special character.*/
then do:
if icCalculationText <> "" and viRow < viMaxLength
then do:
case(viRow):
when 1 then assign ocCalculationPart1 = icCalculationText.
when 2 then assign ocCalculationPart2 = icCalculationText.
when 3 then assign ocCalculationPart3 = icCalculationText.
end case.
leave.
end.
end.
/* found, and put the analysis code to the array. */
if viRow < viMaxLength then
do:
assign vcCalculationElement = SUBSTRING(icCalculationText, 1, viTop - 1, "CHARACTER").
case(viRow):
when 1 then assign ocCalculationPart1 = vcCalculationElement.
when 2 then assign ocCalculationPart2 = vcCalculationElement.
when 3 then assign ocCalculationPart3 = vcCalculationElement.
end case.
if vcCalculationElement = ""
then do:
assign oiReturnStatus = -1.
return.
end.
end.
/* remove the found part last with the character.*/
assign icCalculationText = SUBSTRING(icCalculationText, viTop + 1, -1, "CHARACTER")
viRow = viRow + 1.
if viRow >= viMaxLength
then leave.
end.
/* only support 3 analysis code in the program */
if viRow >= viMaxLength
then do:
assign vcMessage = #T-32'Calculation formula can contain up to 3 elements.':255(693537891)T-32#.
<M-10 run SetMessage
(input vcMessage (icMessage),
input '':U (icArguments),
input 'FRWAnCode.FRWAnCodeCalcElement':U (icFieldName),
input icCalculationText (icFieldValue),
input 'E':U (icType),
input 3 (iiSeverity),
input icRowId (icRowid),
input 'qadfin-156495':U (icFcMsgNumber),
input '':U (icFcExplanation),
input '':U (icFcIdentification),
input '':U (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BFRWAnalysisCode>
assign oiReturnStatus = -1.
end.