获取 EDT 维度数组元素的索引

发布于 2024-11-05 18:37:36 字数 186 浏览 0 评论 0原文

我需要编写一个作业,在其中可以获取 EDT 维度的数组元素的索引 例如,在我的 EDT Dimension 中,我有数组元素 A B C 当我单击它们的属性时,我看到A 的索引为 1,B 为 2,C 为 3。现在有一个作业 ui 想要获取索引值。请协助。

I need to write a job where i could fetch the index of an array element of EDT Dimension
e.g. In my EDT Dimension i have array elements A B C when i click over them for properties I see the index for A as 1, B as 2 and C as 3. Now with a job ui want to fetch the index value. Kindly Assist.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

故乡的云 2024-11-12 18:37:36

我不确定我是否理解真正的问题。一些代码示例可以提供帮助。
Dimensions 表有一些有用的方法,例如 arrayIdx2Code

也许下面的代码有帮助:

static void Job1(Args _args)
{
    Counter         idx;
    Dimension       dimension;
    DimensionCode   dimensionCode;
    str             name;
    ;
    for (idx = 1; idx <= dimof(dimension); idx++)
    {
        dimensionCode = Dimensions::arrayIdx2Code(idx);
        name = enum2str(dimensionCode);
        // if (name == 'B') ...
        info(strfmt("%1: %2", idx, name));
    }
}

I'm not sure if I did understand the real problem. Some code sample could help.
The Dimensions Table has some useful methods like arrayIdx2Code.

Maybe the following code helps:

static void Job1(Args _args)
{
    Counter         idx;
    Dimension       dimension;
    DimensionCode   dimensionCode;
    str             name;
    ;
    for (idx = 1; idx <= dimof(dimension); idx++)
    {
        dimensionCode = Dimensions::arrayIdx2Code(idx);
        name = enum2str(dimensionCode);
        // if (name == 'B') ...
        info(strfmt("%1: %2", idx, name));
    }
}
鱼忆七猫命九 2024-11-12 18:37:36

我找到了一种方法,但仍在寻找是否还有其他解决方案。

static void Job10(Args _args)
{

    Dicttype    dicttype;
    counter     i;
    str         test;
    ;
    test = "Client";
    dicttype = new dicttype(132);//132 here is the id of edt dimension 

    for (i=1;i<=dicttype.arraySize();i++)
    {
        if ( dicttype.label(i) == test)
        {
            break;
        }
    }
    print i;
    pause;

}

I found a way but still looking if there is any other solution.

static void Job10(Args _args)
{

    Dicttype    dicttype;
    counter     i;
    str         test;
    ;
    test = "Client";
    dicttype = new dicttype(132);//132 here is the id of edt dimension 

    for (i=1;i<=dicttype.arraySize();i++)
    {
        if ( dicttype.label(i) == test)
        {
            break;
        }
    }
    print i;
    pause;

}
惜醉颜 2024-11-12 18:37:36

您示例中的数组元素 A B C 只是简单的标签 - 它们不能用作标识符。首先,为了方便用户,标签可以随时修改,然后即使不修改,不同语言的标签也是不同的,等等。

总的来说,您的方法(查询 DictType)是正确的,但我想不出任何实际需要这样代码的场景。

如果您澄清了您的业务需求,有人可以提出更好的解决方案。

Array elements A B C from your example are nothing else but simple labels - they cannot be used as identifiers. First of all, for user convenience the labels can be modified anytime, then even if they aren't, the labels are different in different languages, and so on and so forth.

Overall your approach (querying DictType) would be correct but I cannot think of any scenario that would actually require such a code.

If you clarified your business requirements someone could come up with a better solution.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文