How can i get FCY2FCY Currency Factor

yukonyukon Member Posts: 361
Hi Expert,


Our navision has build in function FCY2LCY,LCY2FCY and FCY2FCY. But that all are amount convert. i can not find FCY2FCY currency factor. It is has in our system. If don't has it, please give me a guide line.



Best Regards,
Yukon
Make Simple & Easy

Comments

  • koubekkoubek Member Posts: 84
    There are functions in Table 330. E.g. ExchangeAmtFCYToFCY(). Parameters are two currencies, amount and date. This function convert amount from one foreign currency to another for specific date. Basicaly You are interested of currency factor related between LCY and FCY and this is included in this table too for each record. If You need currency factor for two FCYs You need calculate it. I don`t know any standard function doing it, but maybe there is someone...
  • rdebathrdebath Member Posts: 383
    The ExchangeAmtFCYToFCY function doesn't round it's return value, so just give it a '1' in the amount and it'll return the factor.
  • yukonyukon Member Posts: 361
    Hi rdebath and koubek,

    Thx 4 your reply.

    If i give 1 in amount, it will be return some value, it is LCY2FCY factory. I wann FCY2FCY factory. Any idea ???? :shock:


    Best Regards,
    Yukon
    Make Simple & Easy
  • koubekkoubek Member Posts: 84
    Use rdebath`s method, it is the simplest and correct way. This is simple calculator:
    OBJECT Form 61240 FCY2FCY Convertor
    {
      OBJECT-PROPERTIES
      {
        Date=21.12.09;
        Time=[ 8:16:01];
        Modified=Yes;
        Version List=;
      }
      PROPERTIES
      {
        Width=6930;
        Height=4290;
        CaptionML=[CSY=FCY2FCY konvertor;
                   ENU=FCY2FCY Convertor];
        SaveValues=Yes;
      }
      CONTROLS
      {
        { 1000000000;TextBox;3630 ;220  ;3080 ;440  ;SourceExpr=gdeAmount }
        { 1000000001;TextBox;3630 ;770  ;3080 ;440  ;SourceExpr=gcoCF1;
                                                     TableRelation=Currency }
        { 1000000002;TextBox;3630 ;1320 ;3080 ;440  ;SourceExpr=gcoCF2;
                                                     TableRelation=Currency }
        { 1000000003;TextBox;3630 ;2750 ;3080 ;440  ;Editable=No;
                                                     SourceExpr=gdeResult }
        { 1000000004;CommandButton;3630;3520;3080;550;
                                                     HorzGlue=Right;
                                                     VertGlue=Bottom;
                                                     CaptionML=[CSY=Spoźˇtej;
                                                                ENU=Calculate];
                                                     OnPush=BEGIN
                                                              gdeResult := Calculate(gdeAmount,gcoCF1,gcoCF2,gdaDate);
                                                              CurrForm.UPDATE(FALSE);
                                                            END;
                                                             }
        { 1000000005;TextBox;3630 ;1870 ;3080 ;440  ;SourceExpr=gdaDate }
        { 1000000006;Label  ;220  ;220  ;3300 ;440  ;CaptionML=[CSY=¬ stka;
                                                                ENU=Amount] }
        { 1000000007;Label  ;220  ;770  ;3300 ;440  ;CaptionML=[CSY=Z mŘny;
                                                                ENU=From Currency] }
        { 1000000008;Label  ;220  ;1320 ;3300 ;440  ;CaptionML=[CSY=Na mŘnu;
                                                                ENU=To Currency] }
        { 1000000009;Label  ;220  ;1870 ;3300 ;440  ;CaptionML=[CSY=Datum;
                                                                ENU=Date] }
        { 1000000010;Label  ;220  ;2750 ;3300 ;440  ;CaptionML=[CSY=Věsledek;
                                                                ENU=Result] }
      }
      CODE
      {
        VAR
          gdeAmount@1000000000 : Decimal;
          gcoCF1@1000000001 : Code[10];
          gcoCF2@1000000002 : Code[10];
          gdeResult@1000000003 : Decimal;
          gdaDate@1000000004 : Date;
    
        PROCEDURE Calculate@1000000001(ideAmount@1000000003 : Decimal;icoCF1@1000000002 : Code[10];icoCF2@1000000001 : Code[10];idaDate@1000000004 : Date) Result : Decimal;
        VAR
          lreCurrExRate@1000000000 : Record 330;
        BEGIN
          EXIT(lreCurrExRate.ExchangeAmtFCYToFCY(idaDate,icoCF1,icoCF2,ideAmount));
        END;
    
        BEGIN
        END.
      }
    }
    
    If Amount is equal to zero, the currency factorwill be calculated for selected currencies... You need to insert rates for specific date into Table 330.
  • yukonyukon Member Posts: 361
    Hi koubek,

    Thk 4 your help. Now, I got it. Your code help 2 me.
    Your one
    EXIT(lreCurrExRate.ExchangeAmtFCYToFCY(idaDate,icoCF1,icoCF2,ideAmount));

    My One
    From := lreCurrExRate.ExchangeRate(FromDate,FromCurrency);
    To := lreCurrExRate.ExchangeRate(FromDate,ToCurrency);
    Exit(To/From);

    Your code is so pretty.

    Thanks and Regards,
    Yukon
    Make Simple & Easy
Sign In or Register to comment.