Skip to main content

Notifications

Finance | Project Operations, Human Resources, ...
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,156 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,156 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

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,253 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,188 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans