Personalized Community is here!
Quickly customize your community to find the content you seek.
Have questions on moving to the cloud? Visit the Dynamics 365 Migration Community today! Microsoft’s extensive network of Dynamics AX and Dynamics CRM experts can help.
2022 Release Wave 1 PlanDynamics 365 release plan for the 2022 release wave 1 describes all new features releasing from April 2022 through September 2022.
2022 release wave 1 plan
The FastTrack program is designed to help you accelerate your Dynamics 365 deployment with confidence.
FastTrack Community | FastTrack Program | Finance and Operations TechTalks | Customer Engagement TechTalks | Upcoming TechTalks | All TechTalks
Hello All,I tried iterating over the datasource records just like the below code snippet shows.
InventTrans localInventTrans = InventTrans_DS.getFirst() as InventTrans;
//access fields by using localInventTrans.fieldname
itemId = localInventTrans.ItemId;
//get the next record from the datasource
localInventTrans = InventTrans_DS.getNext() as InventTrans;
but the problem is the records are being fetched in reverse, for example:if the datasource had three records with ids 1,2 and 3. The ds_.getFirst() returns the last id record ( in this case id=3) and then traverses back.Is there any way I can change this behavior and traverse from the actual first record ( in this case id=1). Thanks.
are you saying that you get them in different sequence than what you see in the form? Are you 100% sure? For me it returns the records in the same sequence than what I see in the form. So perhaps you're misinterpreting the results.
Anyway, I don't think that you can impact what the "getFirst" and "getNext" will return. But you can most likely design your own solution in a way that can handle how the system provides them. And you can even take the data source query, add your own sorting logic and then run the query in your code to get the records in the sequence that you want.
But like I said, to me it seems that the system already works like you are asking. Perhaps there's something wrong with your code. Did you share your actual code with us? Or something else? To me it seems that the code that you shared doesn't do much.
Yes Nikolaos Mäenpää The sequence is reversed from what I see on the form. Not random but totally reverse.
I am doing code in display method like this :
MyTable temp=ds.getFirst() as MyTable;
//// My work here
temp=temp.getNext() as MyTable;
could you please share some screenshots about the situation? Just to make sure there are no misunderstandings.
1) A screenshot of the records on the form
2) Write the ID of each record to infolog in your while loop, and share a screenshot that shows the result
Nikolaos Mäenpää, I debugged the code and from there I identified this issue of records in reverse.
I would love to provide you with screenshots of the data to better clear the problem but In my case it might not be possible for me. I hope you don't mind.
Also having a display method that iterates every record on the form doesn't sound like a good design.
Let's say you have a grid with 20 records, and this display field is shown on the grid.
When the form is opened, the system has to iterate all the records 20 times (one for each time the display method is shown = one for each record visible on the form). This sounds pointless.
You were discussing this display method requirement in another question, so I don't wish to handle it more here. But I think you might get alternative suggestions for solving your business requirement if you just shared your business requirement there. The quality of help you get (and the quality of the result that you will achieve) depends on the quality of the information that you share when asking for help. And I want to help you achieving best possible quality in your work.
If you can't share any more data, then I'm unable to provide any more help.
I hope you'll find a solution to your business requirement, whatever it may be.
Have a nice day!
Yes you are absolutely right that my display method is actually doing exactly like your example and its not efficient in any way. but as I don't have expertise in D365 I am stuck in using display method
Lets say I am standing at record 100th, I have to get the Amount sum of all the previous records and display it in the records 100th.
If I was standing on 4th record then I'll have to get the Amount sum of the previous records and that would be sum of 3 records.
Here's my suggestion: if the user wants to see a sum of some columns, they can export the data to Excel, and simply highlight all the columns that they want to sum. Excel shows the sum of the selected cells automatically.
I'm not sure if there's any nice way to show such "running sum" of all previous rows without a performance disaster. So perhaps you need to rethink this a bit.
Depending on the actual needs of the users, they could also use the new grid capabilities that have recently been added to D365FO : https://docs.microsoft.com/en-us/dynamics365/fin-ops-core/fin-ops/get-started/grid-capabilities
But only if they use D365FO. You posted in AX forum, and used "Dynamics AX (current version)" tag so I'm not sure which version you are using.
Yes you are right. I did include the "running sum" but at the sacrifice of performance. I am looking for a better way.
Thanks a lot for your suggestion and replies. Nikolaos Mäenpää.
Nikolaos Mäenpää As for the problem that I was facing of datasource records are in reverse.
This was because my Datasource property "Start position" was set to "Last".
Business Applications communities