Code Puzzle

Sjoerd
Member Posts: 13
I have this data in tables 355 (Ledger Entry Dimension) and 359 (Posted Document Dimension).
How can I code to obtain the line nr (in this case 20000) in table 359 when i know that:
Movement number 335 and 336 in table 355 correspond to Doc Nr 1 in Table 359 and that the dimension codes and values are exactly the same.
355
Table Nr Mov. Dimension Code Dimension Value
17 335 DimCode1 Value1
17 335 DimCode2 Value2
17 335 DimCode3 Value3
17 336 DimCode1 Value1
17 336 DimCode2 Value2
17 336 DimCode3 Value4
359
Nº Tabela Doc Nr. Line Nr.Dimension Code Dimension Value
123 Doc Nr 1 10000 DimCode1 Value1
123 Doc Nr 1 10000 DimCode2 Value2
123 Doc Nr 1 10000 DimCode3 Value3
123 Doc Nr 1 20000 DimCode1 Value1
123 Doc Nr 1 20000 DimCode2 Value2
123 Doc Nr 1 20000 DimCode3 Value4
( I later on will need this linenumber to get the corresponding description in table 123, (Purchase Invoice Line))
How can I code to obtain the line nr (in this case 20000) in table 359 when i know that:
Movement number 335 and 336 in table 355 correspond to Doc Nr 1 in Table 359 and that the dimension codes and values are exactly the same.
355
Table Nr Mov. Dimension Code Dimension Value
17 335 DimCode1 Value1
17 335 DimCode2 Value2
17 335 DimCode3 Value3
17 336 DimCode1 Value1
17 336 DimCode2 Value2
17 336 DimCode3 Value4
359
Nº Tabela Doc Nr. Line Nr.Dimension Code Dimension Value
123 Doc Nr 1 10000 DimCode1 Value1
123 Doc Nr 1 10000 DimCode2 Value2
123 Doc Nr 1 10000 DimCode3 Value3
123 Doc Nr 1 20000 DimCode1 Value1
123 Doc Nr 1 20000 DimCode2 Value2
123 Doc Nr 1 20000 DimCode3 Value4
( I later on will need this linenumber to get the corresponding description in table 123, (Purchase Invoice Line))
0
Comments
-
Well you have G/L Entries as indicated by Table 17 in the ledger entry dimension table. Click Navigate on a Posted Invoice and see how it works. That should start you in the right direction.0
-
It has to be done in a report, and not in a form!
to be more especific, in the after get record event from a g/l entry record.0 -
Hi,
In the gl ledger entry table you have the document number and if the source type field is vendor you should be able to get the purchase Line record. So you could do something like thisPurchLine.SETRANGE("Document No.,GlLedgerEntry."Document No."); IF PurchLine.FINDSET THEN REPEAT T359.SETRANGE("Document No.",GlLedgerEntry."Document No."); T359.SETRANGE("Line No.",PurchLine."Line No."); IF T359.FINDSET THEN do whatever UNTIL PurchLine.NEXT = 0;
Hope this helps
Albert0 -
Thank you Albert,
but I have a question about the Setrange function, how does it work exactly?
does
T359.SETRANGE("Line No.",PurchLine."Line No.")
filter the values in the the t359 table to all those values that have "line no." en de filtered purchline table? I have multiple lines in the the purchline table.
If it works like this can I filter the t355 table with the dimension values in the 359 table, like this?
T359.SETRANGE(T359."Dimension Code", "T355"."Dimension Code");
T359.SETRANGE(T359."Dimension Value Code", "T355"."Dimension Value Code" ) ;
I tried it but it does not seems to work.0 -
Hi,
you should filter T355 like thisT355.setrange("Table ID",DATABASE::"G/L Ledger Entry"); T355.SETRANGE("Entry No.",GLLedgerEntry."Entry No."); IF T355.FINDSET THEN REPEAT do whatever UNTIL T355.NEXT = 0;
You may have to read the General Ledger Setup table to see which dimension you need.
Edit: Please see the online help for setrange
Regards,
Albert0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.6K Microsoft Dynamics NAV
- 18.7K 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
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 320 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions