Notifications
Announcements
No record found.
Hello,
I need logic to loop through columns(fields) in grid in runtime.
Something similar to this AX 2012: Loop through all the fields of a table in X++ - Dynamics 365 Finance Community but in runtime.
For example if grid data source has 5 columns and 3 are removed in UI, i want to loop just through these 2 that are left in the grid. So my question is how to get grid fields in runtime( not from datasource table) ?
Thank you.
This looks totally different from that what i am looking for.
I need to get grid in the runtime to do additional operations in backend.
Hi Viktors,
Is your question related to Dynamics AX 2012?
Hi,
Yes, I am asking about Dynamics AX 2012 grid, i want to loop through all fields in the grid.
So if I loop through data source of the grid I can achieve it, but if user personalize the grid(add or remove columns on UI) I want to loop through these columns, so that's why I need to catch grid in runtime.
kind regards
Moved to the Dynamics AX forum.
The Export to Excel from the Grid is actually doing the same job (exporting the columns visible on the grid). You can review how Microsoft did implement it for this feature.
Yes, I know and I thought that SysExcel classes do it, but I investigated them and they don't do anything related to that what I need.
So if you have any documentation or reference about Export to Excel function please share with me, thank you.
You can use isVisible
Set all fields's autoDecleration to Yes and check with control.isVisible
As a alternative I wrote a code with treeNode but it seems treeNode can't get usage Data from user. I didn't want spent to much time, probably I didn't catch some point. Here the code, maybe it can be helpfull
static void dmr_ES_GetFormFieldsInfoWithTreeNode(Args _args) { TreeNode treeNode = TreeNode::findNode(@'\Forms\DmrESTestFormVisible\Designs\Design\[Grid:Grid]'); treeNode treeNodeChild; TreeNodeType treeNodeType;// = treeNode.treeNodeType(); FormControl FormControl; FormTreeControl FormTreeControl; void nodeInfo(treeNode _treeNode) { if(treeNodeChild.treeNodeName() != "Methods") { treeNodeType = _treeNode.treeNodeType(); //info(strFmt("Id: %1", treeNodeType.id())); info(strFmt("Name: %1", _treeNode.treeNodeName())); info(strFmt("Name: %1", _treeNode.AOTname())); info(strFmt("AllProperties: %1", _treeNode.AOTgetProperties())); info(strFmt("Visible: %1", _treeNode.AOTgetProperty("Visible"))); info(strFmt("isVisible: %1", _treeNode.AOTgetProperty("Visible"))); } } if(treeNode) { if(treeNode.AOTchildNodeCount()) { treeNodeChild = treeNode.AOTfirstChild(); nodeInfo(treeNodeChild); while(treeNodeChild.AOTnextSibling()) { treeNodeChild = treeNodeChild.AOTnextSibling(); nodeInfo(treeNodeChild); } } } }
isVisible Example
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.
As AI tools become more common, we’re introducing a Responsible AI Use…
We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…
These are the community rock stars!
Stay up to date on forum activity by subscribing.
Martin Dráb 451 Most Valuable Professional
André Arnaud de Cal... 428 Super User 2025 Season 2
BillurSamdancioglu 239 Most Valuable Professional