Table Relation - with two tables..
Sapphire123
Member Posts: 112
Hi,
I'm trying to convert a SQL query to a table relationship for a field's look up...
The SQL Query involves join between two tables ...
Select dimension value.code
From dimension value, general ledger setup
Where dimension value.dimension code = general ledger setup.shortcut dimension 4;
currently, i've hardcoded AREA which is the 4th Shortcut dimension on the General Ledger Setup card, so my table relation property reads,
"Dimension Value".Code WHERE (Dimension Code=FILTER(AREA))
However, I want the look up to change dynamically depending on the selected Shortcut dimension 4.
Any suggestions please?
I'm trying to convert a SQL query to a table relationship for a field's look up...
The SQL Query involves join between two tables ...
Select dimension value.code
From dimension value, general ledger setup
Where dimension value.dimension code = general ledger setup.shortcut dimension 4;
currently, i've hardcoded AREA which is the 4th Shortcut dimension on the General Ledger Setup card, so my table relation property reads,
"Dimension Value".Code WHERE (Dimension Code=FILTER(AREA))
However, I want the look up to change dynamically depending on the selected Shortcut dimension 4.
Any suggestions please?
0
Answers
-
You can filter on field "Global Dimension No." which is 1 or 2, but this value is not set for 3 and up global dimensions (you can change that in code)...0
-
Yes, I noticed that. But - is it not possible to create a table relation using more than one tables?
Also - would you know which code assigns 'Global Dimension No.' to 1, 2, and 0..? My only concern is if I change the Global Dimension No. value for other shortcut dimensions, will it create other issues that i'm not aware of..
0 -
Here's the Solution...
GLSetup.GET;
ShortcutDim4 := GLSetup."Shortcut Dimension 4 Code";
DimValue.SETRANGE(DimValue."Dimension Code", ShortcutDim4);
DimValueList.SETTABLEVIEW(DimValue);
DimValueList.SETRECORD(DimValue);
DimValueList.LOOKUPMODE(TRUE);
IF DimValueList.RUNMODAL = ACTION::LookupOK THEN BEGIN
DimValueList.GETRECORD(DimValue);
"Shortcut Dimension 4 Code" := DimValue.Code;
VALIDATE("Shortcut Dimension 4 Code");
END;
CLEAR(DimValueList);0 -
Hi Sapphire,
There may be another way to solve this which I have used before (not in the example).
Create a flowfilter for the dimension code
create a flowfield that is filtered by the flowfilter
get the shortcutdim4 from GL Setup
set the flowfilter by
setfilter( Dimflowfilter, shortcutdim4 );
and your flowfield should work
Worth a try
0
Categories
- All Categories
- 75 General
- 75 Announcements
- 66.7K Microsoft Dynamics NAV
- 18.8K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 611 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 253 Dynamics CRM
- 103 Dynamics GP
- 6 Dynamics SL
- 1.5K Other
- 991 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 28 Design Patterns (General & Best Practices)
- Architectural Patterns
- 9 Design Patterns
- 4 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1K General Chat
- 1.6K Website
- 77 Testing
- 1.2K Download section
- 23 How Tos section
- 249 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions
