遍历任何表 [英] Iterating over any table

查看:73
本文介绍了遍历任何表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚刚开始新工作,他们使用了Dynamics Ax2009.我是这项技术的新手.

I just started new job where they use dynamics ax 2009. I am new to this technology.

x ++中是否有一种方法可以迭代任何表? 我不知道数据来自哪里,它的长度也不是字段数.

Is there a way in x++ to iterate over any table? I don't know where the data comes from, it's lenght nor field count.

我的意思是我需要一个具有这样功能的函数

What I mean by that is I need a function that would behave like this

void convert(Table anyTable) 
{
    int i=0; 
    int k=0;
    ;

    for(i; i < anyTable.Lenght; i++)
    {
        for(k; k < anyTable[i].Count; k++) 
        {
            //some xml processing 
        } 
    }
} 

(通过表,我指的是所有表的某种父级).这基本上就是我的问题-是否有所有表的父表或某种可以帮助我实现类似目标的表?

(By Table i mean some kind of parent of all tables). And that basically is my question - is there a parent of all tables or something of such sort that can help me achieve something like this?

很抱歉,我是通过移动设备输入此格式的

I am sorry for formatting, im typing this from mobile device

推荐答案

Common表是所有表的基类.它不包含任何数据.它主要用于X ++代码中,以多态方式引用任何表.请检查Dictionary类以解决您的问题:

The Common table is the base class for all tables. It does not contain any data. It is primarily used in X++ code to refer to any table in a polymorphic way. Please check Dictionary classes to solve your issue:

void convert(Common _common)
{
    DictTable       dictTable;
    FieldId         fieldId;
    anytype         value;
    ;

    dictTable = new dictTable(_common.TableId);

    if (dictTable)
    {
        while select _common
        {
            fieldId = dictTable.fieldNext(0);

            while (fieldId)
            {
                value = _common.(fieldId);

                //do processing

                fieldId = dictTable.fieldNext(fieldId);
            }
        }
    }
}

这篇关于遍历任何表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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