Reputation: 15
I am using the InvoiceEntryExt Graph extension, and have added a DAC called 'Receipts' which I have overridden with the IEnumerable method.
public PXSelect<POReceipt> Receipts;
public IEnumerable receipts()
{
List<string> receiptNbrList = new List<string>();
foreach(APTran tran in Base.Transactions.Select())
{
if(!string.IsNullOrEmpty(tran.ReceiptNbr) && !receiptNbrList.Contains(tran.ReceiptNbr))
{
receiptNbrList.Add(tran.ReceiptNbr);
}
}
object[] values = receiptNbrList.ToArray();
PXResultset<POReceipt> rcpts = PXSelect<POReceipt, Where<POReceipt.receiptNbr, In<Required<POReceipt.receiptNbr>>>>.Select(new PXGraph(), values);
return rcpts;
}
When the query executes, I am passing multiple receipt numbers into the values array, but I only get 1 receipt result every time, when I know for a fact there should be more.
Upvotes: 1
Views: 218
Reputation: 7696
The way you are passing the values is not correct, as the code below
object[] values = receiptNbrList.ToArray();
PXResultset<POReceipt> rcpts = PXSelect<POReceipt, Where<POReceipt.receiptNbr, In<Required<POReceipt.receiptNbr>>>>.Select(new PXGraph(), values);
is passing values as params object[] pars
, but that array should contain values corresponding to every Current/Optional/Required.
The correct way to pass parameters for In
operator is the following:
string[] values = receiptNbrList.ToArray();
PXResultset<POReceipt> rcpts = PXSelect<POReceipt, Where<POReceipt.receiptNbr, In<Required<POReceipt.receiptNbr>>>>.Select(new PXGraph(), new object[]{ values });
You should pass an array of objects to the Select method and the first member of that array should be the array of strings which is corresponding to the Required operator in the In operator.
Upvotes: 1