Pages

Banner 468 x 60px

 

Monday, March 27, 2017

Fetch in x++

0 comments
public boolean fetch()
{
    boolean                 abcd = true;
    Query                   _Query = new Query(this.query());
    QueryRun                _QueryRun;
    ;

    _Query.dataSourceTable(tableNum(PurchReqTable)).addRange(fieldNum(PurchReqTable, PurchReqId)).value(_getrecordPurchReqTable.PurchReqId);
    _QueryRun = new QueryRun(_Query);

    while(_QueryRun.next())
    {
        if(_QueryRun.changed(tableNum(PurchReqTable)))
        {
            _getrecordPurchReqTable = _QueryRun.get(tableNum(PurchReqTable));


            companyname           = CompanyInfo::find().Name;
            companyaddress        = CompanyInfo::find().postalAddress().Address;
            pagenumber            = element.page();
            datenow               = systemDateGet();

            no_indent             = _getrecordPurchReqTable.PurchReqId;
            tgl_ind               = _getrecordPurchReqTable.TransDate;
            dlvdate               = _getrecordPurchReqTable.RequiredDate;
            originator            = HcmWorker::find(_getrecordPurchReqTable.Originator).name();

            dateTime              = DateTimeUtil::utcNow();
            timeInUserTimeZone    = DateTimeUtil::time(DateTimeUtil::applyTimeZoneOffset(dateTime, DateTimeUtil::getUserPreferredTimeZone()));

            select firstOnly PurchReqBusJustification where PurchReqBusJustification.RefTableId == _getrecordPurchReqTable.TableId
                                                    && PurchReqBusJustification.RefRecId == _getrecordPurchReqTable.RecId;
            notes                 = PurchReqBusJustification.BusinessJustification;//_getrecordPurchReqTable.BusinessJustification;


            select _PurchTable where _PurchTable.dataAreaId == purchReqLine.PurchIdDataArea &&
            _Purchtable.PurchId == purchReqLine.PurchId;
            BIT_Jabatan1          = PurchParameters::find().BIT_Jabatan1_PR;
            BIT_Jabatan2          = PurchParameters::find().BIT_Jabatan2_PR;
            BIT_Jabatan3          = PurchParameters::find().BIT_Jabatan3_PR;
            BIT_Jabatan4          = PurchParameters::find().BIT_Jabatan4_PR;

            BIT_Nama1             = PurchParameters::find().BIT_NamaPegawai1_PR;
            BIT_Nama2             = PurchParameters::find().BIT_NamaPegawai2_PR;
            BIT_Nama3             = PurchParameters::find().BIT_NamaPegawai3_PR;
            BIT_Nama4             = PurchParameters::find().BIT_NamaPegawai4_PR;

            _purchreqline_DefaultDimension = PurchReqLine::find(_getrecordPurchReqTable.RecId);
            purchReqLine = _QueryRun.get(tableNum(PurchReqLine));

            class_dimStorage      = DimensionAttributeValueSetStorage::find(purchReqLine.DefaultDimension);
            deptcode              = class_dimStorage.getDisplayValueByDimensionAttribute(DimensionAttribute::findByName('Department').RecId);
            deptname              = (select Name from DimAttributeOMDepartment where DimAttributeOMDepartment.value == deptcode).name;


            element.send(_getrecordPurchReqTable);
        }


        if (_QueryRun.changed(tableNum(PurchReqLine)))
        {
            purchReqLine = _QueryRun.get(tableNum(PurchReqLine));

            run_number++;

            itemname              = purchReqLine.Name;
            itemidnoncatalog      = purchReqLine.ItemIdNonCatalog;

            qty                   = purchReqLine.PurchQty;
            purchprice            = purchReqLine.PurchPrice;
            itemid                = purchReqLine.ItemId;
            unit                  = UnitofMeasure::find(purchReqLine.PurchUnitOfMeasure).Symbol;

            select firstOnly _InventDim where _InventDim.dataAreaId == purchReqLine.InventDimIdDataArea
                && purchReqLine.InventDimId == _Inventdim.inventDimId;
            configid              = _inventdim.configId;
            sizeid                = _inventdim.InventSiteId;
            colorid               = _inventdim.InventColorId;

            select firstOnly EcoResConfiguration where EcoResConfiguration.Name == _inventDim.configId;
            configname            = _EcoResProductMasterDimValueTranslation.Name;

            select firstOnly PurchReqBusJustification where PurchReqBusJustification.RefTableId == purchreqline.TableId
                                                    && PurchReqBusJustification.RefRecId == Purchreqline.RecId;
            BusinessJustification = PurchReqBusJustification.BusinessJustification;

            element.send(purchReqLine);
        }

    }
        return abcd;
}

0 comments:

A financial dimension value is based on the record and has been used on a transaction. You cannot delete the record

  SOLUTION delete in table DimensionAttributeLevelValue base on Bank Account  :  and Delete the Bank Account FINISH