Form Layout > 在EventHandler中, 把extension 加入來的VIEW 增加link relation 的方法.

 

 /// <summary>
    ///
    /// </summary>
    /// <param name="args"></param>
    [PostHandlerFor(formStr(InventTrans), formMethodStr(InventTrans, init))]
    public static void InventTrans_Post_init(XppPrePostArgs args)
    {

        FormRun         sender = args.getThis();

        FormDataSource  ds = sender.dataSource('InventTrans');
        Query           query = ds.query();
        QueryRun            queryRun;
        QueryBuildDataSource qbds;
        queryRun = new queryRun(query);
        qbds =  query.dataSourceTable(tableNum(Inventtrrans_warranty_view));
        qbds.joinMode(JoinMode::OuterJoin);
        qbds.relations(true);
        qbds.addLink(fieldNum(InventTrans, itemId), fieldNum(Inventtrrans_warranty_view, itemId));
        qbds.addLink(fieldNum(InventTrans, InventTransOrigin), fieldNum(Inventtrrans_warranty_view, InventTransOrigin));

    }

 

增加前:

+        query    {Query  object 83bd2ff0: SELECT FORUPDATE * FROM InventTransOrigin(InventTransOrigin) JOIN FORUPDATE * FROM InventTransOriginPurchLine(InventTransOriginPurchLine_1) ON InventTransOrigin.RecId = InventTransOriginPurchLine.InventTransOrigin AND PurchLine.dataAreaId=InventTransOriginPurchLine.PurchLineDataAreaId AND PurchLine.InventTransId=InventTransOriginPurchLine.PurchLineInventTransId JOIN FORUPDATE * FROM InventTrans(InventTrans) ON InventTransOrigin.RecId = InventTrans.InventTransOrigin OUTER JOIN FORUPDATE InventTransId FROM InventTransOrigin(Ref_InventTransOrigin_MarkingRefInventTransOrigin) ON InventTrans.MarkingRefInventTransOrigin = InventTransOrigin.RecId AND InventTrans.MarkingRefInventTransOrigin = InventTransOrigin.RecId OUTER JOIN FORUPDATE InventTransId FROM InventTransOrigin(Ref_InventTransOrigin_returnInventTransOrigin) ON InventTrans.ReturnInventTransOrigin = InventTransOrigin.RecId AND InventTrans.ReturnInventTransOrigin = InventTransOrigin.RecId JOIN FORUPDATE * FROM InventDim(InventDim) ON InventTrans.inventDimId = InventDim.inventDimId JOIN FORUPDATE * FROM InventTableModule(InventTableModule) ON InventTrans.ItemId = InventTableModule.ItemId AND ((ModuleType = 0)) JOIN FORUPDATE * FROM Inventtrrans_warranty_view(Inventtrrans_warranty_view)}    Dynamics.AX.Application.Query

增加後:
+        query    {Query  object cdbcc7f0: SELECT FORUPDATE * FROM InventTransOrigin(InventTransOrigin) JOIN FORUPDATE * FROM InventTransOriginPurchLine(InventTransOriginPurchLine_1) ON InventTransOrigin.RecId = InventTransOriginPurchLine.InventTransOrigin AND PurchLine.dataAreaId=InventTransOriginPurchLine.PurchLineDataAreaId AND PurchLine.InventTransId=InventTransOriginPurchLine.PurchLineInventTransId JOIN FORUPDATE * FROM InventTrans(InventTrans) ON InventTransOrigin.RecId = InventTrans.InventTransOrigin OUTER JOIN FORUPDATE InventTransId FROM InventTransOrigin(Ref_InventTransOrigin_MarkingRefInventTransOrigin) ON InventTrans.MarkingRefInventTransOrigin = InventTransOrigin.RecId AND InventTrans.MarkingRefInventTransOrigin = InventTransOrigin.RecId OUTER JOIN FORUPDATE InventTransId FROM InventTransOrigin(Ref_InventTransOrigin_returnInventTransOrigin) ON InventTrans.ReturnInventTransOrigin = InventTransOrigin.RecId AND InventTrans.ReturnInventTransOrigin = InventTransOrigin.RecId JOIN FORUPDATE * FROM InventDim(InventDim) ON InventTrans.inventDimId = InventDim.inventDimId JOIN FORUPDATE * FROM InventTableModule(InventTableModule) ON InventTrans.ItemId = InventTableModule.ItemId AND ((ModuleType = 0)) JOIN FORUPDATE * FROM Inventtrrans_warranty_view(Inventtrrans_warranty_view) ON InventTrans.ItemId = Inventtrrans_warranty_view.ItemId AND InventTrans.InventTransOrigin = Inventtrrans_warranty_view.InventTransOrigin}    Dynamics.AX.Application.Query

創作者介紹
創作者 lionlionchopper 的頭像
lionlionchopper

呆子獅的夢想世界

lionlionchopper 發表在 痞客邦 留言(0) 人氣()