Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics AX forum
Answered

ExchangeRate Table datas cannot be selected

Posted on by 50

pastedimage1592297722724v1.png

i do the jobs on ax 2012,

i want to select the ExchangeRate, but why when i run like that, it not get those data, but right away in the table it can be show and selected.

is that ExchangeRate table have more privileges or what ?

this only with while select, but it show what i not wanted, and newest data.

pastedimage1592297474282v4.png

how can i get that marked data. ExchangeRate == 1396100.000000000000

please help thanks

  • Suggested answer
    nmaenpaa Profile Picture
    nmaenpaa 101,148 on at
    RE: ExchangeRate Table datas cannot be selected

    Good to hear. I'm not sure if your approach of copying the values to another table is the best approach. The data already exists in the system so why not read it directly from ExchangeRate table? Copying the data will add unnecessary overhead in your process and unnecessary complexity in your solution.

    Of course, eventually it depends on your business requirement which we don't know. But normally you should not need to duplicate data.

  • Suggested answer
    Ardhi A Rahman Profile Picture
    Ardhi A Rahman 50 on at
    RE: ExchangeRate Table datas cannot be selected
    [quote user="Ardhi Aulia Rahman"

    When you query ValidTimeState tables (tables with ValidFrom and ValidTo fields) the system returns only records that are valid today.

    If you want to widen the date range, you need to use validTimeState keyword in your select statement. You can provide either a date or a date range.

    docs.microsoft.com/.../effects-of-valid-time-state-tables-on-read-and-write-operations

    thanks nikolaos for reply,

    ok ill research and try it, and give feedback soon

    [/quote

    I found the way to make my requirements easier. create new table, and fill it with all ExchangeRate Table values. and continuing processing my project with my new table.

    static void EU_JBS_ExchangeRate(Args _args)
    
    {
       ExchangeRate             exchangeRate;
       ExchangeRateCurrencyPair exchangeRateCurrencyPair;
       EU_TBL_ExchangeRate xChange;
    
       date dateFrom, dateTo;
       dateFrom = mkDate(01,01,1900);
       dateTo   = mkDate(31, 12, 2154);
       
       //Selecting only USD
       While select
           validTimeState(dateFrom,dateTo)
           * from exchangeRate
           order by exchangeRate.ValidFrom
           where exchangeRate.ExchangeRateCurrencyPair == 5637144576
    
       {
           
           select xChange;
           
           xChange.ExchangeRate = exchangeRate.ExchangeRate;
           xChange.ValidFrom = exchangeRate.ValidFrom;
           xChange.ValidTo = exchangeRate.ValidTo;
           xChange.insert();
    
       }
    
    }

    Thanks Nikolaos and thanks to: Source

  • Ardhi A Rahman Profile Picture
    Ardhi A Rahman 50 on at
    RE: ExchangeRate Table datas cannot be selected
    [quote]

    When you query ValidTimeState tables (tables with ValidFrom and ValidTo fields) the system returns only records that are valid today.

    If you want to widen the date range, you need to use validTimeState keyword in your select statement. You can provide either a date or a date range.

    docs.microsoft.com/.../effects-of-valid-time-state-tables-on-read-and-write-operations

    [/quote]

    thanks nikolaos for reply,

    ok ill research and try it, and give feedback soon

  • Verified answer
    nmaenpaa Profile Picture
    nmaenpaa 101,148 on at
    RE: ExchangeRate Table datas cannot be selected

    When you query ValidTimeState tables (tables with ValidFrom and ValidTo fields) the system returns only records that are valid today.

    If you want to widen the date range, you need to use validTimeState keyword in your select statement. You can provide either a date or a date range.

    docs.microsoft.com/.../effects-of-valid-time-state-tables-on-read-and-write-operations

Helpful resources

Quick Links

Replay now available! Dynamics 365 Community Call (CRM Edition)

Catch up on the first D365 Community Call held on 7/10

Community Spotlight of the Month

Kudos to Saurav Dhyani!

Congratulations to the June Top 10 community leaders!

These stars go above and beyond . . .

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 287,696 Super User

#2
Martin Dráb Profile Picture

Martin Dráb 225,490 Super User

#3
nmaenpaa Profile Picture

nmaenpaa 101,148

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans