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

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

Form data research to retain position for multiple datasources

(0) ShareShare
ReportReport
Posted on by 2,654

Hi,

Hopefully this is straightforward.

I have a standard form with a primary datasource which has a secondary datasource related.

I update a value in field in the secondary datasource and it updates a value in the primary datasource in the form.

I want to call a refresh of the primary datasource, retain it's position in the grid and retain the position of the secondary datasource record as well.

I know calling refresh(true) from the primary datasource will ensure I go back to the correct primary record but it starts at the first record in the secondary datasource grid - I want it to return to its original record prior to update and research.

Hope this makes sense

*This post is locked for comments

I have the same question (0)
  • Verified answer
    Vilmos Kintera Profile Picture
    46,149 on at
    RE: Form data research to retain position for multiple datasources

    Here is a simple example:

    devexpp.blogspot.co.uk/.../refresh-datasource-and-retain-position.html

  • Kauto Profile Picture
    2,654 on at
    RE: Form data research to retain position for multiple datasources

    Thanks Vilmos, can you elaborate a little further please - how do I obtain the cursor value of the secondary record?  Do I not need to pass this into the findRecord() method I am calling the executequery section?

  • Verified answer
    Vilmos Kintera Profile Picture
    46,149 on at
    RE: Form data research to retain position for multiple datasources

    You need to store the current cursor information on every connected datasource you want to retain position for, possibly you could do this in their respective .active() method (which is called for each cursor movement). Then in the executequery of your main table after the super call you could do datasourcejoined_ds.findRecord() to position it on the stored value. Please note that you need to cater for the fact that executequery's super() in fact does fire off active() in the joined datasources, so do not let it overwrite your previous cursor position with the first record entry!

    https://msdn.microsoft.com/en-us/library/formdatasource.findrecord.aspx

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…

Andrés Arias – Community Spotlight

We are honored to recognize Andrés Arias as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Syed Haris Shah Profile Picture

Syed Haris Shah 9

#2
Martin Dráb Profile Picture

Martin Dráb 2 Most Valuable Professional

#2
Community Member Profile Picture

Community Member 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans