web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

update and select count from common table. The table Common does not contain the field XXX.

(0) ShareShare
ReportReport
Posted on by 2,334

How can I select count from Common table and also update it using update_recordset? 

(common table sounds weird, How to frame it in a better technical way?)

Was trying something like below, but it doesn't works:

SysDictTable dt = SysDictTable::newName('Table1');

Common common = dt.makeRecord();



select count(Column1) from common;



update_recordset common

setting column1=0;


Thanks!

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    Hossein.K Profile Picture
    6,648 on at

    Hi MYGz ,

    public Common findRecord(TableId _tableId, RecId _recId, Boolean _forUpdate = false)
    {
        Common      common;
        DictTable   dictTable;
        ;
        dictTable = new DictTable(_tableId);
        common = dictTable.makeRecord();
     
        common.selectForUpdate(_forUpdate);
     
        select common
        where common.RecId == _recId;
     
        return common;
    }


  • Suggested answer
    Hossein.K Profile Picture
    6,648 on at
    public void updateValue(TableId _tableId, RecId _recId, str _field, AnyType _value)
    {
        Common      common;
        Int         fieldId;
        ;
        ttsbegin;
        common = findRecord(_tableId, _recId, true);
        fieldId = fieldname2id(_tableId,_field);
     
        if (fieldId && _value)
        {
            common.(fieldId) = _value;
            common.update();
        }
        ttscommit;
    }
  • Verified answer
    Hossein.K Profile Picture
    6,648 on at

    Count of Common:

    public Common CountRow(TableId _tableId, Boolean _forUpdate = false)
    {
        Common      common;
        DictTable   dictTable;
        ;
        dictTable = new DictTable(_tableId);
        common = dictTable.makeRecord();
     
        common.selectForUpdate(_forUpdate);
     
        select count(RecId) common
        
     
        return common.RecId;
    }


  • MYGz Profile Picture
    2,334 on at

    Thanks. I'm still looking if update_recordset can be used with a common table.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Congratulations to our 2025 Community Spotlights

Thanks to all of our 2025 Community Spotlight stars!

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Joris dG Profile Picture

Joris dG 5

#2
Alexey Lekanov Profile Picture

Alexey Lekanov 2

#2
Henrik Nordlöf Profile Picture

Henrik Nordlöf 2 User Group Leader

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans