project BLF > class BControlProperty > method CreateControlPropertySegment

Description

Initialize a new record in class table tControlPropertySegment.


Parameters


ic_ParentRowidinputcharacter= tControlPropertySegment.tc_ParentRowid
BControlPropertyoutputdatasetclass dataset, containing only the newly initialized record
oiReturnStatusoutputintegererror status


program code (program/bcontrolproperty.p)

    assign oiReturnStatus = -98.

    empty temp-table t_sControlProperty.
    empty temp-table t_sControlPropertySegment.
    empty temp-table t_sCustomTable0.
    empty temp-table t_sCustomTable1.
    empty temp-table t_sCustomTable2.
    find first tFcRowidConvert where
               tFcRowidConvert.tcFcOldRowid = ic_ParentRowid and
               tFcRowidConvert.tlFcOk       no-error.
    if available tFcRowidConvert
    then assign ic_ParentRowid = tFcRowidConvert.tcFcNewRowid.

    find tControlProperty where
         tControlProperty.tc_Rowid = ic_ParentRowid no-error.
    if not available tControlProperty
    then do:
        { includes/bfcrun.i
          &PROCEDURE  = "SetMessage"
          &PARAMETERS = "input 'Invalid parent ID':U,
                         input '',
                         input 'tControlProperty.tc_Rowid':U,
                         input ic_ParentRowid,
                         input 'S':U,
                         input 3,
                         input ic_ParentRowid,
                         input '',
                         input '',
                         input '',
                         input '',
                         output oiReturnStatus" }
        assign oiReturnStatus = -3.
        return.
    end.

    create tControlPropertySegment.
    assign tControlPropertySegment.tc_Rowid  = dynamic-function("GetNumberForNew":U in {&TARGETPROCEDURE})
           tControlPropertySegment.tc_Status = "N":U.
    assign tControlPropertySegment.tc_ParentRowid = tControlProperty.tc_Rowid
           tControlPropertySegment.ControlProperty_ID = tControlProperty.ControlProperty_ID.
    { includes/bfcrun.i
      &procedure  = "InitialValues"
      &parameters = "input 'ControlPropertySegment':U,
                     output oiReturnStatus" }

    create t_sControlPropertySegment.
    raw-transfer tControlPropertySegment to t_sControlPropertySegment.
    assign t_sControlPropertySegment.tc_ParentRowid = ic_ParentRowid.