Showing posts with label range. Show all posts
Showing posts with label range. Show all posts
Saturday, January 12, 2019
Thursday, March 31, 2016
Date valid fields in View and AOT Query
Unfortunately, I did not manage to select addresses effective as of today from the DirPartyPostalAddressView view.

Nevertherless, its ValidTimeStateEnabled property set to Yes.

My workaround is to use SysQueryRangeUtil class providing greaterThanUtcNow and lessThanUtcNow methods to create an extended range. So my Query looks like the following.

Nevertherless, its ValidTimeStateEnabled property set to Yes.

My workaround is to use SysQueryRangeUtil class providing greaterThanUtcNow and lessThanUtcNow methods to create an extended range. So my Query looks like the following.

Saturday, October 3, 2015
How to run a report for multiple records from a grid
Let's say we want to run our report from the previous post not from a Reports menu but directly from the Sales order form. We will use MultiSelectionHelper and its magic method createQueryRanges for this goal.
First of all we need to allow multiple selection for the menu item and place it as a button on the form.
Also we need to slightly change the report controller, so that it could receive the selected records and add an appropriate range to the query before execution.
public static void main(Args _args) { ItemSalesPriceAndBarcodeController controller = new ItemSalesPriceAndBarcodeController(); controller.parmReportName(ssrsReportStr(SalesPriceAndBarcodeReport, Report)); controller.parmArgs(_args); controller.parmShowDialog(true); // if it comes from the form, do not load the saved value if (_args && _args.dataset() == (tablenum(SalesTable))) { controller.parmLoadFromSysLastValue(false); } controller.startOperation(); } /// <summary> /// Executes before the report prompts and calls the method to set the ranges to the query. /// </summary> public void prePromptModifyContract() { this.setRanges(this.getFirstQuery()); } /// <summary> /// Sets the report query ranges based on the caller. /// </summary> /// <param name="_query"> /// The hold the <c>Query</c> object of the report. /// </param> public void setRanges(Query _query) { QueryBuildDataSource qbds; QueryBuildRange qbr; SalesTable salesTable; FormDataSource salesTable_ds; FormRun caller; MultiSelectionHelper helper; if (this.parmArgs() && this.parmArgs().dataset() == (tablenum(salesTable))) { salesTable = this.parmArgs().record(); salesTable_ds = salesTable.dataSource(); caller = this.parmArgs().caller(); //This method will help to get only the marked records from the Grid helper = MultiSelectionHelper::createFromCaller(caller); qbds = _query.dataSourceTable(tablenum(salesTable)); //Create the Query to filter using itemId helper.createQueryRanges(qbds, fieldStr(salesTable, SalesId)); } else { qbds = _query.dataSourceTable(tablenum(salesTable)); qbr = qbds.addRange(fieldNum(salesTable, SalesId)); } }
If user selected certain orders to print from the form, we do not need to restore previously saved parameters.
Feel free to download the full project here.
Feel free to download the full project here.
Labels:
AX2012,
controller,
MultiSelectionHelper,
range,
report
Thursday, August 12, 2010
Value in Query range
How to use Enum values in Query ranges:
public void init() { QueryBuildRange criteriaOpen; ; super(); criteriaOpen = this.query().dataSourceTable(tableNum(ProdTable)).addRange(fieldnum(ProdTable, ProdStatus)); criteriaOpen.value("Started"); // it does not work in non-English interface!!! criteriaOpen.value(enum2str(ProdStatus::StartedUp)); // not enough good...
criteriaOpen.value(QueryValue(ProdStatus::StartedUp); // now it is correct!
}
Subscribe to:
Posts (Atom)