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)

Change dataSource in group on a form

(0) ShareShare
ReportReport
Posted on by

Hello guys,

How can I change dataSource in group control on the form from x++ code?


I have got dataSource method on the group, but i dont know, how can i use it :(

Anyone can help?

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    Bashir Ahmad Profile Picture
    5,248 on at

    Setting the ChangeGroupMode property:

    To create a change group, you use the ChangeGroupMode property of the Data Source node of the form. However, the default behavior is not to use a change group together with a form. You can use ChangeGroupMode to create a change group for any of the following types of forms:

       A new form that you create in the AOT.

       A form that includes date effective data.

       A form with a data source where a parent table has a join relationship to a child table where the child holds a reference to the parent table. The reference can be either mandatory or optional.

    Please read complete detail on : msdn.microsoft.com/.../jj129662.aspx

  • Community Member Profile Picture
    on at

    I havent got that property :/

    I might add, that i need change the datasource of the buttonGroup in ActionPane.

    Can i change it form x++ code?

    I have delete button in that buttonGroup. I want to do smth like, deleting a record from dataSource which is activated. Maybe someone have any idea, how can i do that?

    Thanks for your help!

  • Suggested answer
    Jonathan  Halland Profile Picture
    11,310 on at

    Jerzy,

    Doing what you are requesting may be confusing to users, however I would recommend that you create a standard button and overwrite the "clicked" method, in this method you can then detect what datasource is active and delete accordingly.

  • Bashir Ahmad Profile Picture
    5,248 on at

    As i understand you need to get button on from and from AOT you need to change the properties to Achieve this functionality you need to set AllowUserSetup property that Specifies whether users can move controls on a form, and whether they can change control properties.

    This property is also found on the design of a form. The property has the following outcomes:

    1. No – users cannot customize any controls in this container.

    2. Restricted– users can change properties of individual controls, but cannot move controls.

    3.   Yes – no restrictions on user setup.

    Yes is the default value for AllowUserSetup.

    Full user setup is not allowed if any of the parent containers for the control have restrictions on the user setup level.

    The AllowAdd property on form data sources determines whether a user can add a new field to a form.

  • Community Member Profile Picture
    on at

    Probably you re right Jonathan Halland.

    I though that i can change datasource in group property from x++ code, when I change TabPage. On form, I ve got two grids. First on TableTabPage, second on LinesTabPage.

    Thanks for your response.

  • Verified answer
    Community Member Profile Picture
    on at

    I do smth like that and thats work. Thanks for your help!

    FormTabPageControl activeTabPage;
        ;
    
        activeTabPage = Tab.getActivePage();
    
        if(activeTabPage.name() == "Lines")
        {
           if(RetroAllowanceLine_itp_ds.getFirst(true))
           {
               RetroAllowanceLine_itp_ds.deleteMarked();
           }
           else
           {
               RetroAllowanceLine_itp_ds.delete();
           }
        }
    
        if(activeTabPage.name() == "General" || activeTabPage.name() == "Overview")
        {
            if(RetroAllowanceTable_itp_ds.getFirst(true))
            {
                RetroAllowanceTable_itp_ds.deleteMarked();
            }
            else
            {
                RetroAllowanceTable_itp_ds.delete();
            }
        }

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