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

in X++ validTimeState query

(0) ShareShare
ReportReport
Posted on by 1,215

Hi, all

public void executeQuery()
{
this.query().dataSourceTable(tableNum(NewTestCase)).clearRanges();

if (StartDate.dateValue())
{
this.query().validTimeStateAsOfDate(StartDate.dateValue());
}
if (LessThan.dateValue())
{
this.query().validTimeStateDateRange(LessThan.dateValue() , StartDate.dateValue());
}
if (greaterThan.dateValue())
{
this.query().validTimeStateDateRange(greaterThan.dateValue(), StartDate.dateValue());
}
if (greaterThanEqual.dateValue())
{
this.query().validTimeStateAsOfDate(greaterThanEqual.dateValue()-1);
}
if (lessthanEqual.dateValue())
{
this.query().validTimeStateAsOfDate(lessThanEqual.dateValue()+1);
}
super();

// i am working on inquiry form now i want to how to do it in the ValidTimeState
// aslo how to clear in the grid validTimeState
// 1. start date only working on it.
//2. secound i need a <
// 3. three i need a >
// 4. four i nedd a <=
// 5. five i need a >=
// in x++ how to do it ValidTimestate

thanks

I have the same question (0)
  • Verified answer
    Sergei Minozhenko Profile Picture
    23,093 on at

    Hi Riyas,

    What kind of issue you have?

    For eqality case you need to use validTimeStateAsOfDate and in other cases validTimeStateDateRange.

    So I think in your case it should be like

    1. this.query().validTimeStateAsOfDate(StartDate.dateValue());

    2. this.query().validTimeStateDateRange(dateNull() , StartDate.dateValue() - 1);

    3. this.query().validTimeStateDateRange(StartDate.dateValue() + 1, datemax());

    4. this.query().validTimeStateDateRange(dateNull() , StartDate.dateValue());

    5. this.query().validTimeStateDateRange(StartDate.dateValue(), datemax());

  • Riyas ahamed F Profile Picture
    1,215 on at

    Many thanks sergei sir now working fine

    but how to clear in the grid normal clearranges not working validTimeState

    thanks

  • Sergei Minozhenko Profile Picture
    23,093 on at

    Hi Riyas,

    Do you want clear validTimeState parameters? Or do you want to clear ranges?

  • Riyas ahamed F Profile Picture
    1,215 on at

    Now , once I set to datevalue it is record filtered but remove the data grid is filtered only show not able to clear data how to clear range set to validTimeState

  • Sergei Minozhenko Profile Picture
    23,093 on at

    Hi,

    Default state is this.query().validTimeStateAsOfDate(systemdateget());

  • Riyas ahamed F Profile Picture
    1,215 on at

    Hi, sir

    I don't want systemgetDate

    Now, I want to how to clear data in the grid also usually addrange we can use clear ranges datasoure but, my question

    In validTimeState how to set clear so that what to be done.

  • Verified answer
    Sergei Minozhenko Profile Picture
    23,093 on at

    Hi Riyas,

    There is no clear option for ValidTimeState. The default state is for today. If you want to see all records without limitation you need to use validTimeStateDateRange(dateNull(), dateMax());

  • Riyas ahamed F Profile Picture
    1,215 on at

    Thanks for your valuable answer sir.

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
Liquid error: parsing "/globalsearch/?q=%E0%B8%A8%E0%B8%B2%E0%B8%A5%E0%B8%B2%E0%B9%81%E0%B8%94%E0%B8%87++%E0%B8%A0%E0%B8%B2%E0%B8%A9%E0%B8%B2%E0%B8%AD%E0%B8%B1%E0%B8%87%E0%B8%81%E0%B8%A4%E0%B8%A9" - Nested quantifier +.