collect data of filtered query on form

Hi ,

I have created form by using view as data source. I opened form and data filtered with multiple sales order. I clicked on ok button. On this action I want to catch all this sales orders ie filtered sales orders. Please help.

I am designing above form in AX 2012 R3. check boxes is available by default. I selected multiple check boxes then how to collect that selected data ?

Hi,

you can use Datasourcname_ds.getFirst(0) and Datasourcname_ds.getNext(0) in code to get the selected records.

for ex?

you can use MultiSelectionHelper class also

refer this link

mafsarkhan.blogspot.in/…/get-select-records-by.html

Thanks for your reply! I write below code with reference to your reply -

Voided_PaymentReceipts Voided_PaymentReceipts_1;
MultiSelectionHelper helper = MultiSelectionHelper::construct();
helper.parmDatasource(Voided_PaymentReceipts_ds);
Voided_PaymentReceipts_1 = helper.getFirst();

while (Voided_PaymentReceipts_1.RecId != 0)
{
info(Voided_PaymentReceipts_1.salesOrderId);
Voided_PaymentReceipts_1 = helper.getNext();

}

but it’s displaying only first salesorder id where as I am filtering with multiple sales order id.

Use this code

void clicked()
{
CustTable custTable;
super();

//getFirst method gets all the selected records in the grid
custTable = CustTable_ds.getFirst(true);
while (custTable)
{
info(strfmt(“You selected Item %1”,custTable.AccountNum));
// get the next selected record
custTable = CustTable_ds.getNext();
}
}

not working above code . info is blank

RetailTransactionTable _RetailTransactionTable;

super();

_RetailTransactionTable = RetailTransactionTable_ds.getFirst(true);
info(_RetailTransactionTable.salesOrderId);
while(_RetailTransactionTable)
{
info(_RetailTransactionTable.salesOrderId);
RetailTransactionTable_ds.getnext();
}

share your form design node screen shot

Replies above are about something else than what you asked for (selected records instead of all records for given query ranges).

To get the query with user ranges, call queryRun().query() on your datasource. Then you can execute the query with QueryRun as usual.

For example:

Query q = RetailTransactionTable_ds.queryRun().query();
QueryRun queryRun = new QueryRun(q);

while (queryRun.next())
{
}