project QadFinancials > class BFRWColumnGroup > method ValidateComponentPostFRWColDet
Description
Validate the column group details
Parameters
oiReturnStatus | output | integer | Return status of the method. |
Internal usage
QadFinancials
program code (program1/bfrwcolumngroup.p)
/* ================================================================= */
/* Validate the column groups details */
/* ================================================================= */
for each t_sFRWColDet where
t_sFRWColDet.tc_ParentRowid = t_sFRWCol.tc_Rowid and
t_sFRWColDet.tc_Status <> 'D':U:
/* ======================================================================== */
/* When the amount type is calculated all other dropdowns should be entered */
/* These are measure type, unit type, period type and compare type */
/* ======================================================================== */
if t_sFRWColDet.FRWColDetColumnType <> {&FRWCOLDETCOLUMNTYPE-CALCULATED} and
t_sFRWColDet.FRWColDetColumnType <> {&FRWCOLDETCOLUMNTYPE-COMPOSED}
then do:
/* check if the other fields have been entered. */
if t_sFRWColDet.FRWColDetMeasureType = {&FRWCOLDETMEASURETYPE-BLANK} or
t_sFRWColDet.FRWColDetMeasureType = ?
then do:
assign oiReturnStatus = -1.
<M-71 run SetMessage
(input #T-1'When column type is not set to calculated or composed, a measure type is required.':255(382638806)T-1# (icMessage),
input '':U (icArguments),
input 'tFRWColDet.FRWColDetMeasureType' (icFieldName),
input t_sFRWColDet.FRWColDetMeasureType (icFieldValue),
input 'E':U (icType),
input 3 (iiSeverity),
input t_sFRWColDet.tc_Rowid (icRowid),
input 'qadfin-51880':U (icFcMsgNumber),
input '':U (icFcExplanation),
input '':U (icFcIdentification),
input '':U (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BFRWColumnGroup>
end.
if t_sFRWColDet.FRWColDetUnitType = {&FRWCOLDETUNITTYPE-BLANK} or
t_sFRWColDet.FRWColDetUnitType = ?
then do:
assign oiReturnStatus = -1.
<M-10 run SetMessage
(input #T-57'When column type is not set to calculated or composed, a unit type is required.':255(137615042)T-57# (icMessage),
input '':U (icArguments),
input 'tFRWColDet.FRWColDetUnitType' (icFieldName),
input t_sFRWColDet.FRWColDetUnitType (icFieldValue),
input 'E':U (icType),
input 3 (iiSeverity),
input t_sFRWColDet.tc_Rowid (icRowid),
input 'qadfin-937695':U (icFcMsgNumber),
input '':U (icFcExplanation),
input '':U (icFcIdentification),
input '':U (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BFRWColumnGroup>
end.
if t_sFRWColDet.FRWColDetPeriodType = {&FRWCOLDETPERIODTYPE-BLANK} or
t_sFRWColDet.FRWColDetPeriodType = ?
then do:
assign oiReturnStatus = -1.
<M-84 run SetMessage
(input #T-36'When column type is not set to calculated or composed, a period type is required.':255(431017160)T-36# (icMessage),
input '':U (icArguments),
input 'tFRWColDet.FRWColDetPeriodType' (icFieldName),
input t_sFRWColDet.FRWColDetPeriodType (icFieldValue),
input 'E':U (icType),
input 3 (iiSeverity),
input t_sFRWColDet.tc_Rowid (icRowid),
input 'qadfin-125370':U (icFcMsgNumber),
input '':U (icFcExplanation),
input '':U (icFcIdentification),
input '':U (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BFRWColumnGroup>
end.
if (t_sFRWColDet.FRWColDetCompareType = {&FRWCOLDETCOMPARETYPE-BLANK} or
t_sFRWColDet.FRWColDetCompareType = ?) and
(t_sFRWColDet.FRWColDetPeriodType <> {&FRWCOLDETPERIODTYPE-PROMPT} and
t_sFRWColDet.FRWColDetPeriodType <> {&FRWCOLDETPERIODTYPE-QUARTER} and
t_sFRWColDet.FRWColDetPeriodType <> {&FRWCOLDETPERIODTYPE-FIXED} )
then do:
assign oiReturnStatus = -1.
<M-89 run SetMessage
(input #T-72'When column type is not set to calculated or composed, a compare period type is required.':255(404771367)T-72# (icMessage),
input '':U (icArguments),
input 'tFRWColDet.FRWColDetCompareType' (icFieldName),
input t_sFRWColDet.FRWColDetCompareType (icFieldValue),
input 'E':U (icType),
input 3 (iiSeverity),
input t_sFRWColDet.tc_Rowid (icRowid),
input 'qadfin-185744':U (icFcMsgNumber),
input '':U (icFcExplanation),
input '':U (icFcIdentification),
input '':U (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BFRWColumnGroup>
end.
end. /* if t_sFRWColDet.FRWColDetColumnType <> {&FRWCOLDETCOLUMNTYPE-CALCULATED} or {&FRWCOLDETCOLUMNTYPE-COMPOSED} */
/* ======================================================================== */
/* The percentage sign or currency sign cannot be larger than 3 characters */
/* ======================================================================== */
if length(t_sFRWColDet.FRWColDetUnitLabel,"CHARACTER":U) > 3
then do:
assign oiReturnStatus = -1.
<M-70 run SetMessage
(input #T-24'The percentage sign or currency sign cannot be longer than 3 characters.':255(524429444)T-24# (icMessage),
input '':U (icArguments),
input trim(#T-25'Sign (%, $, ...)':33(717762108)T-25#) (icFieldName),
input t_sFRWColDet.FRWColDetUnitLabel (icFieldValue),
input 'E':U (icType),
input 3 (iiSeverity),
input t_sFRWColDet.tc_Rowid (icRowid),
input 'qadfin-738946':U (icFcMsgNumber),
input '':U (icFcExplanation),
input '':U (icFcIdentification),
input '':U (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BFRWColumnGroup>
end.
/* ======================================================================== */
/* The Offset cannot be zero for some values */
/* ======================================================================== */
if t_sFRWColDet.FRWColDetCompareOffset = 0 and
(t_sFRWColDet.FRWColDetColumnType <> {&FRWCOLDETCOLUMNTYPE-CALCULATED} and
t_sFRWColDet.FRWColDetColumnType <> {&FRWCOLDETCOLUMNTYPE-COMPOSED})
then do:
if t_sFRWColDet.FRWColDetPeriodType <> {&FRWCOLDETPERIODTYPE-QUARTER} and
t_sFRWColDet.FRWColDetPeriodType <> {&FRWCOLDETPERIODTYPE-PROMPT} and
t_sFRWColDet.FRWColDetPeriodType <> {&FRWCOLDETPERIODTYPE-COMPARE} and
t_sFRWColDet.FRWColDetPeriodType <> {&FRWCOLDETPERIODTYPE-FIXED}
then do:
<M-41 run SetMessage
(input #T-59'Compare offset cannot be zero. Please re-enter.':50(137655297)T-59# (icMessage),
input '':U (icArguments),
input 'tFRWColDet.FRWColDetCompareOffset' (icFieldName),
input t_sFRWColDet.FRWColDetCompareOffset (icFieldValue),
input 'E':U (icType),
input 3 (iiSeverity),
input t_sFRWColDet.tc_Rowid (icRowid),
input 'qadfin-624284':U (icFcMsgNumber),
input '':U (icFcExplanation),
input '':U (icFcIdentification),
input '':U (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BFRWColumnGroup>
assign oiReturnStatus = -1.
end. /* if t_sFRWColDet.FRWColDetPeriodType <> {&FRWCOLDETPERIODTYPE-QUARTER} and */
end. /* if t_sFRWColDet.FRWColDetCompareOffset = 0 and */
/* ======================================================================== */
/* Fixed Period from/to should be manditory when period type is fixed. */
/* ======================================================================== */
if t_sFRWColDet.FRWColDetPeriodType = {&FRWCOLDETPERIODTYPE-FIXED}
then do:
if t_sFRWColDet.FRWColDetFixedPeriodFrom = 0 or t_sFRWColDet.FRWColDetFixedPeriodFrom = ? then
do:
<M-27 run SetMessage
(input #T-43'Fixed period from should be mandatory when period type is 'Fixed'.':255(884132034)T-43# (icMessage),
input '':U (icArguments),
input 'tFRWColDet.FRWColDetFixedPeriodFrom' (icFieldName),
input t_sFRWColDet.FRWColDetFixedPeriodFrom (icFieldValue),
input 'E':U (icType),
input 3 (iiSeverity),
input t_sFRWColDet.tc_Rowid (icRowid),
input 'qadfin-543284':U (icFcMsgNumber),
input '':U (icFcExplanation),
input '':U (icFcIdentification),
input '':U (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BFRWColumnGroup>
assign oiReturnStatus = -1.
end.
if t_sFRWColDet.FRWColDetFixedPeriodTo = 0 or t_sFRWColDet.FRWColDetFixedPeriodTo = ? then
do:
<M-37 run SetMessage
(input #T-42'Fixed period to should be mandatory when period type is 'Fixed'.':255(109325877)T-42# (icMessage),
input '':U (icArguments),
input 'tFRWColDet.FRWColDetFixedPeriodTo' (icFieldName),
input t_sFRWColDet.FRWColDetFixedPeriodTo (icFieldValue),
input 'E':U (icType),
input 3 (iiSeverity),
input t_sFRWColDet.tc_Rowid (icRowid),
input 'qadfin-281595':U (icFcMsgNumber),
input '':U (icFcExplanation),
input '':U (icFcIdentification),
input '':U (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BFRWColumnGroup>
assign oiReturnStatus = -1.
end.
end.
/* ======================================================================== */
/* check that the analysis code entered for each column actually exists */
/* and has the same report chart as the one entered for the column group */
/* ======================================================================== */
if t_sFRWColDet.FRWAnCode_ID <> ? and
t_sFRWColDet.FRWAnCode_ID <> 0
then do:
/* a column can only have an analysis code with one dimension */
<Q-80 run FRWAnCodeElemByFRWAnCodeID (all) (Read) (NoCache)
(input t_sFRWColDet.FRWAnCode_ID, (AnalysisCodeID)
output dataset tqFRWAnCodeElemByFRWAnCodeID) in BFRWAnalysisCode>
/* if there are elements to the analysis code then count them */
assign viAnCodeElemCount = 0.
for each tqFRWAnCodeElemByFRWAnCodeID where
tqFRWAnCodeElemByFRWAnCodeID.tiFRWAnCode_ID = t_sFRWColDet.FRWAnCode_ID.
assign viAnCodeElemCount = viAnCodeElemCount + 1.
end.
/* if the there is more than one element produce an error */
if viAnCodeElemCount > 1
then do:
assign oiReturnStatus = -1.
<M-22 run SetMessage
(input #T-47'Report Analysis Code has mulitple COA dimensions. Only single COA dimension Analysis Codes are allowed on columns.':255(302951939)T-47# (icMessage),
input '':U (icArguments),
input 'tFRWColDet.tcFRWAnCodeCode' (icFieldName),
input t_sFRWColDet.tcFRWAnCodeCode (icFieldValue),
input 'E':U (icType),
input 3 (iiSeverity),
input t_sFRWColDet.tc_Rowid (icRowid),
input 'qadfin-450090':U (icFcMsgNumber),
input '':U (icFcExplanation),
input '':U (icFcIdentification),
input '':U (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BFRWColumnGroup>
end. /* if viAnCodeElemCount > 1 */
end. /* if t_sFRWColDet.tcFRWAnCodeCode <> ? and */
if t_sFRWColDet.FRWColDetColumnType = {&FRWCOLDETCOLUMNTYPE-COMPOSED} then
do:
<M-16 run ValidateComponentPostFRWColDetComp (output viFcReturnSuper (oiReturnStatus)) in BFRWColumnGroup>
if viFcReturnSuper < 0 or viFcReturnSuper > 0 and oiReturnStatus = 0 then assign oiReturnStatus = viFcReturnSuper.
end.
end. /* for each t_sFRWColDet where t_sFRWColDet.tc_ParentRowid = t_sFRWCol.tc_Rowid: */