Skip to main content

Notifications

Announcements

No record found.

Finance | Project Operations, Human Resources, ...
Answered

what is called in super(append) from form's datasource create method

(0) ShareShare
ReportReport
Posted on by 768

Hello,

When I create a record on the form in the datasource is called the following methods:

Form — Datasource — create ()

Form — Datasource — initValue ()

Table — initValue ()

Form — Datasource — active ()

But in the create method of the datasource InventJournalTrans of the form InventJournalCountTransfer I have the following code:

void create(boolean append = false)
{
    ;
    journalFormTrans.datasourceCreatePre();
    super(append);
}

and in the super(append) I have one value in the datasource InventJournalTrans  changed and I can't find where it's happening. I tried to go into super(append) and some methods of the table InventJournalTrans  are launched but nowhere there I have found needed value changing. So the question is where super(append) leads? To which tableor datasource method?

Thank you.

  • dark_knight Profile Picture
    dark_knight 768 on at
    RE: what is called in super(append) from form's datasource create method

    Also, don't forget that you have full power to CHANGE the LineNum before inserting the record, if you have a duplicate. You can use the lastLineNum method to determine what new line number you should assign.

    lastLineNum() is called inside insert() method of the table InventJournlTrans only if LineNum is equal to 0. IN my case it's equal to 4. I added a code to the init value of the custom form so that LineNum is always equal to 0 and that's resolved my issue. In insert() method of the InventJournlTrans it changes to the lastLineNum + 1 which does make sense. Thanks for you help.

  • Verified answer
    nmaenpaa Profile Picture
    nmaenpaa 101,156 on at
    RE: what is called in super(append) from form's datasource create method

    Also, don't forget that you have full power to CHANGE the LineNum before inserting the record, if you have a duplicate. You can use the lastLineNum method to determine what new line number you should assign.

  • Suggested answer
    nmaenpaa Profile Picture
    nmaenpaa 101,156 on at
    RE: what is called in super(append) from form's datasource create method

    Aha, so it's a custom form.

    Most likely you have some issue there.

    For the third time: this might happen because of table relations. Do you perhaps open your custom form from another form, that also has InventJournalTrans as a data source? If yes, then table relations might set these fields when you create a new record on your form.

    In such case you can call clearDynalinks() method of the QueryBuildDataSource in the init method of your custom form. Search the web for dynamics ax clearDynaLinks to get more information.

  • dark_knight Profile Picture
    dark_knight 768 on at
    RE: what is called in super(append) from form's datasource create method

    Actually when I press F11 on the super(append) line inside create() method firstly this display method from table InventJournlTrans:

    111.JPG.jpg

    It simply returns the value of field BoxingLabel from table inventtable

    Then I go on with F10 and this display method  on InventJournlTrans table starts:

    112.JPG.jpg

    Then If I go on the first display method itemBoxingLabel() starts again and then unitId() method starts again. So every method actually starts twice one by one. But they don't change the value of LineNum field anyhow.

    After that I get into initValue() method of the datasource InventJournlTrans and at that moment I already have my LineNum value equal to 4.

    After that empty line is created in the custom form InventJournalCountTransfer. There I already have some records and there I have a record with the lineNum equal to 4 and my new line I'm filling uo also has got lineNum equal to 4. LineNum field is inside unique index on the table InventJournlTrans. That's why when I try to save my new line I get error that record already exists. That's why I try to understand why I have LineNum field for the new record initialized to 4. I hope it helps.

    Did you already try to put a breakpoint in the lastLineNum method and see if it gets hit?

    I tried and I don't get there. 

  • nmaenpaa Profile Picture
    nmaenpaa 101,156 on at
    RE: what is called in super(append) from form's datasource create method

    I would be surprised if a display method would change data - that would be completely wrong. So it's good that they are not changing any data.

    Did you already try to put a breakpoint in the lastLineNum method and see if it gets hit?

    And, as I wrote, table relations can also explain your situation. Perhaps you could walk us through the entire process, starting from main menu?

  • dark_knight Profile Picture
    dark_knight 768 on at
    RE: what is called in super(append) from form's datasource create method

    OK. Yes. Some custom display methods are launched when I step into create() method super(append) line and nowhere there LineNum is changed. So that's why I try to understand maybe the only methods I see there are not all methods that actually start.

  • nmaenpaa Profile Picture
    nmaenpaa 101,156 on at
    RE: what is called in super(append) from form's datasource create method

    You can find out the sequence by debugging. I don't understand what's the problem. You said that you found out that some methods are called. So it should be very easy to find out the sequence. What kind of problems do you have? Can you share any more details?

  • dark_knight Profile Picture
    dark_knight 768 on at
    RE: what is called in super(append) from form's datasource create method

    OK. Thanks. But how to understand where super(append) in form's datasource create method leads? I see that it launches some methods from InventJournalTrans but how to get the exact sequence? Simply debugging gives me some methods from InventJournalTrans  when I step into super(append) by F11 but it doesn't make any sense for me.

    While debugging when I stop at form's datasource InventJournalTrans initvalue() method and LineNum is already populated with some value. So it happens before table's InventJournalTrans.lastlinenum() method.

  • Suggested answer
    nmaenpaa Profile Picture
    nmaenpaa 101,156 on at
    RE: what is called in super(append) from form's datasource create method

    I don't see a form called InventJournalCountTransfer in my system. Do you mean InventJournalTransfer?

    Normally the line number is initialized in method lastLineNum of table InventJournalTrans, so you could try to debug it.

    Generally, some values can be populated automatically on forms, based on table relations. Not sure if that could be the explanation in your case. But in such cases it's done by the kernel and you can't see the code that populates the value. 

  • dark_knight Profile Picture
    dark_knight 768 on at
    RE: what is called in super(append) from form's datasource create method

    Hello Nikolaos,

    LineNum

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

Congratulations 2024 Spotlight Honorees

Kudos to all of our 2024 community stars! 🎉

Meet the Top 10 leaders for December

Congratulations to our December super stars! 🥳

Start Your Super User Journey

Join the ranks of our community heros! 🦹

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,735 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,466 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans