![]() |
#1 |
Участник
|
Preston.Larimer: Dynamic selection criteria in X++
Источник: http://palarimer.greenlight2go.com/2...eria-in-x.html
============== Occasionally I’ve had a situation where using a while select statement to loop through a set of records and needed the fields used in the selection criteria to be dynamic based on arguments passed to the method. Dynamics AX offers a slick way of dealing with this that is used in the standard application code but is still pretty obscure. The following method demonstrates using a variable select statement based on passed in arguments and using the NEXT keyword to move the record set forward. In this example we’re just outputting the Item ID to an info log but you could get much more creative…. X++: void SelectNextSample(salesID _salesID, inventtransID _inventTransID = '') { salesLine salesLine; ; if (_inventTransID) { select salesLine where salesLine.SalesId == _salesID && salesLine.InventTransId == _inventTransID; } else { select salesLine where salesLine.SalesId == _salesID; } while (salesLine) { info(salesLine.ItemId); next salesLine; } } Источник: http://palarimer.greenlight2go.com/2...eria-in-x.html
__________________
Расскажите о новых и интересных блогах по Microsoft Dynamics, напишите личное сообщение администратору. |
|
|
|