显示方法-多个表单数据源 [英] Display Methods - Multiple Form Data Sources

查看:73
本文介绍了显示方法-多个表单数据源的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这似乎是一个简单的问题,但由于某种原因,我感到烦恼.

This may seem a simple question, but for some reason I am vexed.

我有一个包含3个数据源的表单-InventTableInventSumInventDim.

I have a form with 3 datasources - InventTable, InventSum, InventDim.

例如,我的网格显示;

So, for example, my grid shows;

物品,名称,地点,仓库,实物存货

我已经在数据源的InventDim上放置了一种显示方法,但是我需要从inventTransInventSum访问ItemId. (显然是在寻找当前" itemId).

I have placed a display method on InventDim form DataSource, but I need access to the ItemId from either inventTrans or InventSum. (Obviously looking for the "current" itemId).

我只能访问的是inventDim,它作为参数_inventDim作为标准传递.

All I can access is the inventDim which is passed as a parameter _inventDim, as standard.

访问当前" itemId的最佳方法是什么?

What is the best way to access the "current" itemId?

推荐答案

好的,我找到了答案,非常感谢Joris de Gruyter的引用;

Okay, I found the answer, with great thanks to this reference by Joris de Gruyter;

http://daxmusings.blogspot. co.uk/2011/10/forum-advanced-display-method-querying.html

关键是将显示方法放在InventSum数据源上.

The key was to put the display method on the InventSum datasource.

然后您可以使用_inventSum.joinChild()来检索链接的inventDim,这是Joris的示例;

You can then use _inventSum.joinChild() to retrieve the linked inventDim, here is Joris' example;

display Qty AvailPhysical(InventSum _inventSum)
{
    InventDim       joinDim, dimValues;
    InventDimParm   dimParm;
    InventSum       localSum;

    //THE IMPORTANT LINE...
    dimValues.data(_inventSum.joinChild());

    dimParm.initFromInventDim(dimValues);

    select sum(AvailPhysical) from localSum where localSum.ItemId == _inventSum.ItemId
        #InventDimExistsJoin(localSum.InventDimId, joinDim, dimValues, dimParm);

    return localSum.AvailPhysical;
}

我相信这会在将来帮助某人!

I am sure this will help someone out in the future!

这篇关于显示方法-多个表单数据源的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆