[Form]
public class YNV_ResAvailabilityQueryForm extends FormRun
{
[DataSource]
class ResActivityResourceRequestReservationUnionView
{
/// <summary>
///
/// </summary>
public void executeQuery()
{
QueryBuildDataSource queryBuildDataSource;
TransDate queryDate = today() + 30;
QueryBuildRange queryRange,taskNameRange;
queryBuildDataSource = this.query().dataSourceTable(tablenum(ResActivityResourceRequestReservationUnionView));
queryBuildDataSource.clearRanges();
taskNameRange = queryBuildDataSource.addRange(fieldnum(ResActivityResourceRequestReservationUnionView, TaskName ));
taskNameRange.value("Production");
taskNameRange.status(RangeStatus::Locked);
taskNameRange.status(RangeStatus::Hidden);
queryRange = queryBuildDataSource.addRange(fieldnum(ResActivityResourceRequestReservationUnionView, EndTime ));
queryRange.value(queryRange(dateNull(),queryDate));
queryRange.status(RangeStatus::Locked);
queryRange.status(RangeStatus::Hidden);
// Set order mode to group by
queryBuildDataSource.orderMode(OrderMode::GroupBy);
// Add group by field
queryBuildDataSource.addGroupByField(fieldNum(ResActivityResourceRequestReservationUnionView, Resource));
// Add selection field for max EndTime
queryBuildDataSource.addSelectionField(fieldNum(ResActivityResourceRequestReservationUnionView, EndTime), SelectionField::Max);
super();
}
}
No comments:
Post a Comment