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)

Loop form datasource

(0) ShareShare
ReportReport
Posted on by 2,426

Good morning ,

As i have a requirement when i open a form and click at any point i mean any record

and i will click one button then there is one customized field on form which should generate number based on input given at the time of clicking that button.

Ex - i opened form

i selected 5 th record and i clicked button then dialog opens which ask me start from i will write 1

then numbers should generate from 5.

i tried looping through this

for(fdpaymentjournal = paymentJournalfds.getNext() ; fdpaymentjournal ; fdpaymentjournal = paymentJournalfds.getNext() )
{

}

i tried even get first() and get selection but no luck

Please help me if i select any record that form datasource should loop in my class

please show some light on this.

Regards.

Have a great day.

*This post is locked for comments

I have the same question (0)
  • Martin Dráb Profile Picture
    237,965 Most Valuable Professional on at

    Sorry, it's not clear to me which records you're trying to iterate. Could you please explain the business requirement you're trying to implement?

  • AX 2012 r3 Profile Picture
    2,426 on at

    1.i have one form in that i have one field

    2.Created one class which updates that field with continuous number

    3.In that class i will take number to start as parameter

    4.i want to update all the records in form.

    5.when i open the form the cursor is always on top.

    if i change the cursor position and i select 5th record

    if i click that button i am not able to get the first record .

    How can i achieve this.

    Even when cursor position is at last i want to update from starting

    i have searched and i used this

    for(fdpaymentjournal = paymentJournalfds.getNext() ; fdpaymentjournal ; fdpaymentjournal = paymentJournalfds.getNext() )

    {

    }

    But first time it is updating and even if i change position

    But after second time it is not even entering the for loop.

  • Verified answer
    Martin Dráb Profile Picture
    237,965 Most Valuable Professional on at

    What's the purpose of the field and its update?

    Why do you do it in a form on client at all? Don't you want to update all records in the table, regardless of which ones are currently fetched in the report? If so, you should update the table on server and then merely reload data in the form.

  • AX 2012 r3 Profile Picture
    2,426 on at

    you are correct updating table i  have already done that.

    I need through form data source is it possible to get records.even my cursor is at last.

  • Martin Dráb Profile Picture
    237,965 Most Valuable Professional on at

    Why do you want to develop a much worse solution (several times slower, more work) if you already know how to do it properly? Don't ever use your design; you would meaninglessly fetch all records to client just to send them back to server, which wouldn't make sense.

  • AX 2012 r3 Profile Picture
    2,426 on at

    "Why do you want to develop a much worse solution".

    I have kept conditions.it will update only if value is not there.

    Once updated wont come into picture again.

  • Martin Dráb Profile Picture
    237,965 Most Valuable Professional on at

    I'm sorry, but I have no idea what you mean. Please try a bit more elaborate explanation.

  • AX 2012 r3 Profile Picture
    2,426 on at

    i am actually generating cheque numbers

    they will provide start number like 100001 then all records will get updated so no need to give cheque numbers and those will get printed in cheque print report.

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