Mateusz Wójcik
Mateusz Wójcik

Reputation: 13

How to take value from combo box table microsoft dynamics ax 2012 x++ while select

I have table like (1st photo) table

What I should do to take this value to while select in x++? (2c photo) value

Upvotes: 0

Views: 1630

Answers (1)

Alex Kwitny
Alex Kwitny

Reputation: 11564

The short answer is you would need to take the return from the lookup, find the value in the table via the returned value (key), and take the Name field.

So this would be the data in your case for the first result:

InventLocation::find('11').Name

This is what's called a lookup. When you do a lookup, there are multiple methods that AX will determine what values to display. The one you're looking at is a lookup based upon the Extended Data Type relation.

  • EDT - In this case \Data Dictionary\Extended Data Types\InventLocationId
  • Table - which has a reference table of \Data Dictionary\Tables\InventLocation
  • Primary Key - which has an alternate primary key of \Data Dictionary\Tables\InventLocation\Indexes\InventLocationIdx, which I believe in this case determines the return value
  • AutoLookup - and the AutoLookup located at \Data Dictionary\Tables\InventLocation\Field Groups\AutoLookup determines which fields are displayed to the user as information.

If you want a custom lookup to return the InventLocation.Name field, you should look at the different methods available to you. This blog post is an excellent start to see different methods: https://kashperuk.blogspot.com/2009/04/lookup-methods-tutorial-custom-list.html

Upvotes: 2

Related Questions