Get Function in NAV Reports
                
                    James111                
                
                    Member Posts: 63                
            
                        
            
                    Helle,
I have problem, because i would like get Exchange Rate from other table in my report (Header Section).
I now that i must use GET function, but i try using this function in 1000 ways:), and its doesn't work.
I try some think like this:
Variable:
Exchange -- record -- Table of Exchange Rate
IF Exchange.GET(Exchange."No.",Exchange."No."Currency Code") THEN;
THIS IS A PRIMARY KEY OF TABLE - EXCHANGE RATE
Please, tell me what i doing wrong.
James
                I have problem, because i would like get Exchange Rate from other table in my report (Header Section).
I now that i must use GET function, but i try using this function in 1000 ways:), and its doesn't work.
I try some think like this:
Variable:
Exchange -- record -- Table of Exchange Rate
IF Exchange.GET(Exchange."No.",Exchange."No."Currency Code") THEN;
THIS IS A PRIMARY KEY OF TABLE - EXCHANGE RATE
Please, tell me what i doing wrong.
James
0                
            Comments
- 
            Hello James111,
you write wrong primary key's value.
IF Exchange.GET(Exchange."No.",Exchange."No."Currency Code") THEN;
1. In above statement syntax is wrong, you forgot to put , (Comma) between two fields.
2. "No." is writen twice.
Your syntax should be like this.
IF Exchange.GET("No.","Currency Code") THEN
Begin
Do Something
End
OR
IF Exchange.GET(Exchange."No.",Exchange."Currency Code") THEN
Begin
Do Something
End
This may solve your problem.
Thanks & Regards,
Purvesh Maisuria.0 - 
            Hi,
Thanks for answer,
I try doing to what You say, but it doesn't work, mayby I must doing SETRANGE??
Thanks,0 - 
            Hello James,
Use this, not or part.
IF Exchange.GET("No.","Currency Code") THEN
Begin
Do Something
End
Now what is your recored/table variable in report (Header Section) ?
in GET function there are "No." & "Currency Code" is of record variable.
Try to do it with static information first like below.
IF Exchange.GET('XYZ123','USD') THEN
Begin
Do Something
End
Thanks & Regards,
Purvesh Maisuria.0 - 
            Ok I try doing report with statistic variable.
Thans for all,
If i solve a problem - i will write:)0 - 
            I guess the Primary Key of Currency Exchange Rate table is Currency Code,Starting Date
so better useCurrencyExchRate.SETRANGE("Currency Code",CurrencyCode); CurrencyExchRate.SETRANGE("Starting Date",0D,Date); CurrencyExchRate.FINDLAST;0 - 
            Mohana,
I tried use static variables and it's run:
IF Exchange.GET('TEST','EUR') THEN
Message(FORMAT(Exchange."Relational Exch. Rate Amount"));
But if I substitue variables it's doesn't work.
I don't understand this situation.0 - 
            Debug and check if the variables provide a pk value. Also, check the functions in Currency Exchange Rate table to learn how to obtain a curr. rate or convert between currencies.Ufuk Asci
Pargesoft0 - 
            I have no more idea,
I showed the table of exchange rates,
I will add that I use Get function in Header OnPreDataItem.
I don't know where i must use function Exchange.SETRANGE...0 - 
            What's the main dataitem - Sales Header? or something?
in your first post:
IF Exchange.GET(Exchange."No.",Exchange."No."Currency Code") THEN;
As pointed out Exchange."no."currency code" is wrong but that wouldn't have worked anyway.
the values inside the parenthasis that match the primary key of the exchange table (the table info you want to get) can't be from the same table. It should be from fields of your dataitem.
Example lets say I want "GET" customer table info but I have "sales header" as my dataitem.
variable->cust->record->customer
if Cust.get("Sales Header"."Sell-to Customer No.") then.....now you can get values from the customer table.
Your first post is basically saying
if Cust.Get(Cust."No.") then...which won't work.
If the dataitem you are using doesn't have the values you need to fill the primary key of the "Get" table then that's when you use FIND,FINDLAST,FINDFIRST...
Put your find onaftergetrecord of the dataitem in your report. you didn;t specify your dataitems se we can't give any more details.0 
Categories
- All Categories
 - 73 General
 - 73 Announcements
 - 66.7K 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
 - 323 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
 
