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)

set up value to a form control

(0) ShareShare
ReportReport
Posted on by

Hi, I want to set a form field value after doing a modification on another field in the same form. I've created a modify method to fill the second field automatically and I tried too many functions but the field is not filled when modifying the first one.

I want to know how to refer to fields from the same form using x++ code?

The value I want to set is a real value and I want it to be changed before creating the line int the table,  because some fields can't be modified after the

*This post is locked for comments

I have the same question (0)
  • Mea_ Profile Picture
    60,284 on at

    Hey Ameni Omrani,

    Could you please share  your code ? It's hard to say what is wrong without seeing actual code.

    Meanwhile you can check this blog post ajstudi0.blogspot.co.nz/.../microsoft-dynamics-ax-table-method.html

    section about modifiedField method.

  • Community Member Profile Picture
    on at

    Hi Ievgen, I'm just trying to modify the value of the second field automatically after modifying the first field on the form, I added a code to the modify method of the first field but it doesn't work

  • Community Member Profile Picture
    on at

    Hi Crispin,

    Yes that's what i'm doing. I tried to test with an info message and the table field is getting the right value but i'm having troubles with displaying it in the form instantly. What I need is quite simple: a function that allows me to assign a real value to a realEdit form control just after modifying the previous field (which is a combo box)

  • Community Member Profile Picture
    on at

    Hi!

    for example

    public boolean modified()

    {

       boolean ret;

       ret = super();

       ComboBox.selection(1);

       element.redraw();

       return ret;

    }

  • Community Member Profile Picture
    on at

    Hi Grigory,

    I don't need to assign a value to the combo box, but to the next field after modifying the combo box . I'll try to explain more:

    I have two controls in  my form (control 1 and control 2).

    control 1 is a combo box that has two enums: enum1 and enum2, and the second control is a realEdit field.

    if i choose enum 1 in the combo box, control 2 displays  realValue1 automatically, if not, control 2 displays realValue2.

  • Community Member Profile Picture
    on at

    Ok

    For Control1

    example

    public boolean modified()

    {

       boolean ret;

       real    value;

       ret = super();

       switch (Control1.selection())

       {

           case AccountingEventType::Cancel:

               value = 100;

               break;

           case AccountingEventType::Finalize:

               value = 1000;

               break;

           default:            

               value = Control1.selection();

       }

       Control2.realValue(value);

       element.redraw();

       return ret;

    }

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