Dynamics AX
  RSS Feed  LinkedIn  Twitter
Want to turn you're data into a true asset? Ready to break free from the report factory?
Ready to gain true insights that are action focused for truly data informed decisions?
Want to do all of this across mutliple companies, instances of Dynamics and your other investments?
Hillstar Business Intelligence is the answer then! (www.HillstarBI.com)

Hillstar Business Intelligence for Microsoft Dynamics AX and NAV on Mobile, Desktop, Tablet

Let us prove to you how we can take the complexity out of the schema and truly enable users to answer the needed questions to run your business! Visit Hillstar Business Solutions at: www.HillstarBI.com

Wednesday, August 02, 2006

Creating and using an Edit method on a Datasource

I was wanting to emulate a "marking" of a record within a grid, similar to the way this is done when you settle a payment journal. Well I created a edit method of NoYes type on the InventTable datasource for the form I was working on. Seemed like it would work, and used the InventTable.RecId field, which is the datasource record, to store and base the return off of.

When I tried this though the grid kept acting strange. I would mark one, and then leave the record, which would then make the one below or above marked and not the one I just marked. I really scratched my head on this one and sent an email out to the Axapta Knowledge Villiage news group. An associate by the name of Steeve said that if I could get the current InventTable record passed in then I could make it work. He also stated that he could not get it to compile.

Well I messed around with this a little and found out the reason why my buddy Steeve could not get it to compile. Turns out, the boolean set must be the first variable passed in. Then the NoYes variable must be the Last (there is the key), and the passed in current record be between those two passed in variables. With this I was able to create an edit method that worked like the settle method and have the grid behave like it was suppose to.

Below is example code of the edit method and the correct way to achieve this:

edit NoYes MarkSKUs(boolean set,
InventTable Invent,
NoYes _markSKUs)

if (set)
if (MarkMap.exists(Invent.RecId))
_markSKUs = MarkMap.lookup(Invent.RecId);

return _MarkSKUs;

Find a job at: www.DynamicsAXJobs.com


Anonymous Martin said...

There is a difference in the edit-method in a table and in a datasource, as you can read at http://msdn.microsoft.com/en-us/library/aa637541(AX.10).aspx

9:26 AM  
Anonymous Amr Saad said...

Thanks for that, but from where should I call the created edit method?

5:00 AM  
Blogger Priyan said...


A small query

why do we need the below statement


5:17 AM  
Blogger Alex K said...


I don't believe you need the "MarkMap.valueSet();"

That line should just return the Set from the map.

See here:

2:04 PM  

Post a Comment

<< Home

Copyright 2005-2011, J. Brandon George - All rights Reserved