Pages

Saturday, March 19, 2022

How to add custom range method to apply range on View.

Hi All,
In this blog will learn how to add range method same as  SysQueryRangeUtil methods and apply on view.

Requirement - Add range in view to take only records up to last month ( Today() – days of current date)  i.e equal to up to last month transactions

Solution -  Create new class and add method according to the range and copy method attribute [QueryRangeFunction]

x++ Code
public static class TestVoyageClass
{
 [QueryRangeFunction]
public static str lessthanLastMonth()
{
int days ;
utcdatetime currentDateTime;
currentDateTime = DateTimeUtil::applyTimeZoneOffset(DateTimeUtil::getSystemDateTime(), DateTimeUtil::getUserPreferredTimeZone());
days = DateTimeUtil::day(currentDateTime)-1;
return SysQueryRangeUtil::lessThanDate(-days);
}
}
Add method name in range property of view. 


 







Thats It !!

No comments:

Post a Comment