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

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

dynamically dataGroup on Form

(0) ShareShare
ReportReport
Posted on by

Hi,

I have trouble with this:

I would like dynamically change dataGroup on group control in my form.

I have this in active method on my main datasource

public int active()
{
    int ret;

   ret = super();
  if(TrvExpTrans_CostType.valueStr()=="Cost2")
     {
         DetailGroup.autoDataGroup(true);
         DetailGroup.dataGroup("Transaction_Travel4");


         element.redraw();

         info("test");


     }
    else
    {
            DetailGroup.autoDataGroup(true);
         DetailGroup.dataGroup("Transaction_Travel5");
         element.redraw();
    }
 

   


    return ret;
}

Even if I choose row with costType "Cost2" on form in detail group I still see fields from fieldsgroup "Transaction_Travel5", but I see info test,

that I know that it is into if in good place.

Thanks for help.

*This post is locked for comments

I have the same question (0)
  • XB Profile Picture
    1,875 on at

    I think is more easy create two datagroup an set visible with your conditions.

  • Community Member Profile Picture
    on at

    But it is only example

     In my project I have 20 fieldsgroup, I hope that could do it without creating 20 group in my form :)

  • Suggested answer
    Vilmos Kintera Profile Picture
    46,149 on at

    I could not find a way to manipulate form data groups on-the-fly, only by adding the controls myself.

    Also do not do it in active(), because you could be in a loop situation, unless you only get 1 record always in the buffer.

    I have researched how to do this and made a post, I hope this helps:

    https://www.daxrunbase.com/2016/09/21/add-ax-formgroupcontrol-runtime/

  • XB Profile Picture
    1,875 on at

    If I'm not wrong with your options tthe object will be modified on the layer of the user.

  • Vilmos Kintera Profile Picture
    46,149 on at

    You are wrong, it is "runtime". Refer to AOT > Forms > tutorial_Form_AddControl. To validate for tests sake, you could try to force an AOTsave() on the forms' treenode, and will see that the changes are not reflected back to the AOT.

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Martin Dráb Profile Picture

Martin Dráb 4 Most Valuable Professional

#1
Priya_K Profile Picture

Priya_K 4

#3
MyDynamicsNAV Profile Picture

MyDynamicsNAV 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans