Wednesday, June 16, 2021

Set range for SrsReportRunController through X++ D365FO

 Map queryContracts  = reportController.parmReportContract().parmQueryContracts();

        MapEnumerator mapEnumerator = queryContracts.getEnumerator();

        while(mapEnumerator.moveNext())

        {

            Query query = mapEnumerator.currentValue();

            if(query)

            {

                QueryBuildDataSource qbds = query.dataSourceTable(tableNum(WHSWorkLine)); 

                if(qbds)

                {

                    qbds.addRange(fieldNum(WHSWorkLine, ShipmentId)).value(queryValue(_shipmentTable.ShipmentId));

                }

            }

        }

Function to check whether DS is exists or not in QUERY D365FO

QueryBuildDataSource findFirstDsForTable(Query _q, TableId _tableId)

{

    QueryBuildDataSource ds;

    int i;

    for (i = 1; i <= _q.dataSourceCount(); i++)

    {

        ds = _q.dataSourceNo(i);

        if (ds.table() == _tableId)

        {

            return ds;

        }

    }

    return null;

}


Convert Call stack to readable format in D365FO X++

//Input --container _xppCallStack = xSession::xppCallStack();  Public static str POL_formatXppCallStack(container _xppCallStack, int _skipFr...