AXForum  
Go Back   AXForum > Microsoft Dynamics AX > DAX: Программирование
All
Forgotten Your Password?
Register Forum Rules FAQ Members List Today's Posts Search

 
 
Thread Tools Search this Thread Display Modes
Old 25.05.2006, 13:55   #1  
PavelSR is offline
PavelSR
Участник
 
98 / 10 (1) +
Join Date: 25.05.2006
? Перечисление полей таблицы
Можно ли по табличной переменной узнать количество полей в таблице и перебрать их?
Old 25.05.2006, 13:58   #2  
mit is offline
mit
Участник
mit's Avatar
 
386 / 36 (2) +++
Join Date: 15.01.2003
Location: Moscow
да, загляните в таблицу SqlDictionary, правда про временные там нет ничего
Old 25.05.2006, 14:00   #3  
Dron AKA andy is offline
Dron AKA andy
Moderator
 
944 / 253 (10) ++++++
Join Date: 27.03.2002
Location: Москва
Code:
dictTable = new DictTable(myTableVariable.tableId);
for (i = 1; i <= dictTable.fieldCnt(); i++)
    info(new DictField(dictTable.fieldCnt2id(i)).name());
__________________
Андрей.
Old 25.05.2006, 14:19   #4  
somebody is offline
somebody
Участник
 
128 / 30 (2) +++
Join Date: 30.04.2003
Location: Москва
Мне надо было занести в массивы структуру таблицы. Сделал так (Аксапта 2.5):

X++:
    Dictionary                  dict        = new Dictionary();
    DictTable                   priceDt     = new DictTable(dict.tablename2id(tablestr(PriceDiscTable)));
    FieldId                     fieldId;
    int                         fieldCnt;                           // кол-во полей
    int                         fieldIds[];                         // массив идентификаторов полей
    str                         fieldNames[];                       // массив имён полей
    boolean                     nonSystemField[];                   // массив признаков "обычное поле?"

    // структура таблицы PriceDiscTable

    fieldCnt    = priceDt.fieldCnt();

    for (i = 1; i <= fieldCnt; i += 1)
    {
        fieldIds[i]         = priceDt.fieldCnt2Id(i);
        fieldNames[i]       = priceDt.fieldName(fieldIds[i]);

        nonSystemField[i]   = true;
        if (any2int(fieldIds[i]) >= 60000)       // "системное" поле
            nonSystemField[i]   = false;
    }
Ну и замените в этом коде Id таблицы на tableId от табл. переменной...

Last edited by mazzy; 08.07.2014 at 10:52.
Old 25.05.2006, 14:06   #5  
PavelSR is offline
PavelSR
Участник
 
98 / 10 (1) +
Join Date: 25.05.2006
А можно по подробнее... у меня мало опыта... таблицы SqlDictionary в AOT я не нашел а в System Documentation не понятно как определить количество полей.
Old 25.05.2006, 14:08   #6  
Gad is offline
Gad
Участник
 
136 / 18 (1) ++
Join Date: 21.05.2003
Location: Москва
Code:
static void MyMethod(CustTable  _custTable)
{
    DictTable      dictTable = new DictTable(_custTable.TableId);
    int            i;
    ;

    for(i = 1; i <= dictTable.fieldCnt(); i++)
    {
        info(strfmt(_custTable.(dictTable.fieldCnt2Id(i))));
    }
}
Old 25.05.2006, 14:13   #7  
mit is offline
mit
Участник
mit's Avatar
 
386 / 36 (2) +++
Join Date: 15.01.2003
Location: Moscow
находится здесь
\System Documentation\Tables\SqlDictionary,
можно делать выбоки объявив SqlDictionary как таблицу.
но наверное будет удобнее как предлагают Андрей и Gad
Old 25.05.2006, 14:39   #8  
PavelSR is offline
PavelSR
Участник
 
98 / 10 (1) +
Join Date: 25.05.2006
А как можно добраться до значения Label выбранного поля.
Old 25.05.2006, 14:47   #9  
Gad is offline
Gad
Участник
 
136 / 18 (1) ++
Join Date: 21.05.2003
Location: Москва
Через DictField, который в конструкторе new DictField() принимает в качестве параметров id таблицы и поля
Old 25.05.2006, 15:02   #10  
PavelSR is offline
PavelSR
Участник
 
98 / 10 (1) +
Join Date: 25.05.2006
Благодарю за оказанную помощь... Вроде разобрался.
 

Similar Threads
Thread Thread Starter Forum Replies Last Post
Лукап, отображающий список полей определённой таблицы Damn DAX: Программирование 7 17.09.2010 18:00
Как получить имена полей, которые есть у таблицы? 3oppo DAX: Программирование 2 22.12.2006 14:30
Свойство AllowEdit полей таблицы Lucky13 DAX: Программирование 4 29.07.2005 14:14
Изменение ID-ов полей таблицы somebody DAX: Программирование 5 02.02.2004 19:57
Объединить несколько полей таблицы в одном поле Grid-а на форме? storer DAX: Программирование 2 12.11.2003 14:08

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Рейтинг@Mail.ru
All times are GMT +3. The time now is 21:27.
Powered by vBulletin® Version 3.8.5
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Contacts E-mail, Advertising.