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

Announcements

No record found.

News and Announcements icon
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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Congratulations to our 2025 Community Spotlights

Thanks to all of our 2025 Community Spotlight stars!

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

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 555 Super User 2026 Season 1

#2
Giorgio Bonacorsi Profile Picture

Giorgio Bonacorsi 364

#3
Diego Mancassola Profile Picture

Diego Mancassola 259

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans