while inside while and group by


My requirement is I am filtering data on form by using multiple sales order id. Then I need to check multiple ledger vouchers posted against respective sales orders. How to do it?

I have written below query but it’s giving repetitive records -

GeneralJournalEntry journalEntry;
GeneralJournalAccountEntry accountEntry;
RetailTransactionTable _RetailTransactionTable;

while select _RetailTransactionTable where _RetailTransactionTable.salesOrderId == ‘01371885’
while select journalEntry group by SubledgerVoucher exists join accountEntry
where accountEntry.GeneralJournalEntry == journalEntry.RecId
&& accountEntry.PaymentReference == _RetailTransactionTable.salesOrderId
info(strFmt("%1 = %2",_RetailTransactionTable.salesOrderId,journalEntry.SubledgerVoucher));

Please help

This question is already discussed in another thread, while select, join and group by query. Please continue the discussion there; repeating the same discussion at two places is time-consuming and doesn’t add any value.

By the way, I asked you to put development-related to the developer forum. Please remember it next time.