web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Answered

ExchangeRate Table datas cannot be selected

(0) ShareShare
ReportReport
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

I have the same question (0)
  • Verified answer
    nmaenpaa Profile Picture
    101,160 Moderator on at

    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

  • Ardhi A Rahman Profile Picture
    50 on at
    [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

  • Suggested answer
    Ardhi A Rahman Profile Picture
    50 on at
    [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

  • Suggested answer
    nmaenpaa Profile Picture
    101,160 Moderator on at

    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.

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > Finance | Project Operations, Human Resources, AX, GP, SL

#1
Martin Dráb Profile Picture

Martin Dráb 565 Most Valuable Professional

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 450 Super User 2025 Season 2

#3
Sohaib Cheema Profile Picture

Sohaib Cheema 250 User Group Leader

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans