Dynamics Nav 2009 Drop Down using Field Groups

Hi All,

Thanks to the below blog I have gathgered a lot of ino about Drop Downs, but I have a question from Field Groups.

http://blogs.msdn.com/b/clausl/archive/ … roups.aspx

Is it possible to have the drop down list to display different set of fields from different Pages, I can see that it is possible to add a 2nd line or 3rd line to the Field Groups with different Name. If not, what is the use of creating multiple Field Groups for a table.

I am using a table for multi-purpose to save creating new table for storing simple 2 or 3 fields data by segregating the data using a Type field. In short same table is used to store entirely different set of data. But the problem is when I want to display different set of data on lookup from other pages.

There is no way to do this directly as you cannot select a FieldGroup from any of the table relation properties.

Anyway what you could do is to trick the system with the following:

In the page, you create a global variable for the field value you want to provide an individual lookup for.
Then you assign the value of the field to this variable in the OnAfterGetRecord trigger and assign the variable value to the field in the OnValidate trigger of the control. Do not forget to clear the variable in the “OnNewRecord” trigger.

So, that was step 1.

Step 2 will need a bit more work:

You need to utilize a table which has a simple Code/Description structure - any will do when you are happy with two fields in the dropdown.
You add a field to that table for your “Type”
You create a page on this table and set the SourceTableTemporary property of the page to Yes.
In the OnOpenForm trigger you just populate the table like the following code I’m using:


COPYFILTER("Table No.",Field.TableNo);
IF Field.FINDSET() THEN BEGIN
REPEAT
INIT;
"Line No." := Field."No.";
"Field No." := Field."No.";
Property := Field.FieldName;
Value := Field."Field Caption";
"Table No." := Field.TableNo;
INSERT;
UNTIL Field.NEXT = 0;
FINDFIRST;
END;

Step 3:

Then you set the table relation in your variable field at the page from Step 1 to this table, and set a where condition for your “Type” field:
My Example (according to the code above):
“Property Buffer”.“Field No.” WHERE (Table No.=CONST(1020837))
Then you set the DrillDownPageID and LookupPageID to the number of the page created in Step2

That was it.
Now you can use the new lookup mechanism for different purposes on your table just based on the filter in your type (my “Table No.” in this example).