How to get multi data from argument - Song Nghia - Microsoft Dynamics 365 Vietnam

Song Nghia - Microsoft Dynamics 365 Vietnam

Microsoft Dynamics AX/365 Outsourcing Service

Breaking

Monday, October 5, 2020

How to get multi data from argument

How to  get multi data from argument

        

Song Nghia - Technical Consultant
    private void checkAssetBooksStatus()
    {
        // Copy the main datasource query
        Query query = new Query(assetBook_ds.query());
        QueryBuildDataSource qbdsAssetBook = query.dataSourceTable(tableNum(AssetBook));

        // Finding all value models NOT in Open status to provide infolog warnings.
        QueryBuildRange statusRange = xSysQuery::findOrCreateRange(qbdsAssetBook, fieldNum(AssetBook, Status));
        statusRange.value(strfmt("%1,%2", SysQuery::valueNot(AssetStatus::Open), SysQuery::valueNot(AssetStatus::Closed)));

        QueryRun queryRun  = new QueryRun(query);

        // Check if any of the selected valuemodels are Not in open status.
        // Show infolog warning for all such selected value models.
        if (SysQuery::countLoops(queryRun) > 0)
        {
            warning("@FixedAssets:FA_MessageNotification_BooksCannotBeTransferedBecauseStatusIsWrong");

            while (queryRun.next())
            {
                AssetBook localAssetBook = queryRun.get(tableNum(AssetBook));
                
                warning(strFmt("@FixedAssets:FA_MessageNotification_AssetAndBookInformation", localAssetBook.AssetId, localAssetBook.BookId));
                
            }
        }

        statusRange = xSysQuery::findOrCreateRange(qbdsAssetBook, fieldNum(AssetBook, Status));
        statusRange.value(strfmt("%1,%2", SysQuery::value(AssetStatus::Open), SysQuery::value(AssetStatus::Closed)));

        //Close the form if no value models are selected that are in the Open or Closed status.
        if (SysQuery::countLoops(new QueryRun(query)) <= 0)
        {
            this.closeCancel();
        }
    }

No comments:

Post a Comment