Get Function in NAV Reports

James111James111 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

Comments

  • Purvesh_MaisuriaPurvesh_Maisuria Member Posts: 71
    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.
  • James111James111 Member Posts: 63
    Hi,

    Thanks for answer,


    I try doing to what You say, but it doesn't work, mayby I must doing SETRANGE??

    Thanks,
  • Purvesh_MaisuriaPurvesh_Maisuria Member Posts: 71
    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.
  • James111James111 Member Posts: 63
    Ok I try doing report with statistic variable.

    Thans for all,

    If i solve a problem - i will write:)
  • mohana_cse06mohana_cse06 Member Posts: 5,504
    I guess the Primary Key of Currency Exchange Rate table is Currency Code,Starting Date

    so better use
      CurrencyExchRate.SETRANGE("Currency Code",CurrencyCode);
      CurrencyExchRate.SETRANGE("Starting Date",0D,Date);
      CurrencyExchRate.FINDLAST;
    
  • James111James111 Member Posts: 63
    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.
  • ufukufuk Member Posts: 514
    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
    Pargesoft
  • James111James111 Member Posts: 63
    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...
  • SavatageSavatage Member Posts: 7,142
    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.
Sign In or Register to comment.