project BLF > class BCustomField > method ValReturnField

validation procedure

Description

If lookup is a stored search, lookup return field must be a valid filter field of the query of the stored search.


Parameters


icTargetFieldinputcharacterValue of the business field to validate.
icTargetFieldNameinputcharacterName of the business field to validate.
icRowidinputcharacterContents of field tc_Rowid, if the target field is a field of a component temp-table.
icLookupRefinputcharacter
oiReturnStatusoutputintegerReturn status of the method.


Internal usage


BLF
validation on relation STOREDSEARCHINCUSTOMFIELD


program code (program1/bcustomfield.p)

if icTargetField = ""
or icTargetField = ?
then do:
    oiReturnStatus = -1.
    <M-67 run SetMessage
       (input  #T-3'You must select a return field for the stored search.':255(779395116)T-3# (icMessage), 
        input  '' (icArguments), 
        input  icTargetFieldName (icFieldName), 
        input  icTargetField (icFieldValue), 
        input  'E' (icType), 
        input  3 (iiSeverity), 
        input  icRowid (icRowid), 
        input  'blf-224927':U (icFcMsgNumber), 
        input  '' (icFcExplanation), 
        input  '' (icFcIdentification), 
        input  '' (icFcContext), 
        output viFcReturnSuper (oiReturnStatus)) in BCustomField>
end.
else do:
    if num-entries(icLookupRef,"/") = 2
    then vcLookupRef = entry(2,icLookupRef,"/").
    else vcLookupRef = icLookupRef.
    
    <I-37 {bFcOpenInstance
         &CLASS           = "Session"}>
    <M-39 run GetBusinessFields
       (input  vcLookupRef (icReference), 
        output tBusinessFields (tBusinessFields), 
        output tCustomRelation (tCustomRelation), 
        output viFcReturnSuper (oiReturnStatus)) in Session>
    <I-89 {bFcCloseInstance
         &CLASS           = "Session"}>
    
    if viFcReturnSuper <> 0
    then oiReturnStatus = viFcReturnSuper.
    if viFcReturnSuper < 0
    then return.
    
    if not can-find (first tBusinessFields where
                           tBusinessFields.tcFcFieldName = icTargetField and
                           tBusinessFields.tcFcFieldType = "F")
    then do:
        oiReturnStatus = -1.
        <M-16 run SetMessage
           (input  #T-95'Return Field is not valid for this stored search.':255(386250518)T-95# (icMessage), 
            input  '' (icArguments), 
            input  icTargetFieldName (icFieldName), 
            input  icTargetField (icFieldValue), 
            input  'E' (icType), 
            input  3 (iiSeverity), 
            input  icRowid (icRowid), 
            input  'blf-806240':U (icFcMsgNumber), 
            input  '' (icFcExplanation), 
            input  '' (icFcIdentification), 
            input  '' (icFcContext), 
            output viFcReturnSuper (oiReturnStatus)) in BCustomField>
    end.
end.

finally:
    empty temp-table tBusinessFields.
    empty temp-table tCustomRelation.
end finally.