I have this x++ method:
public void run()
{
CustTable ct;
DirPartyTable dir;
DirAddressBookParty party;
DirAddressBook ab;
int ctr = 0;
;
while
select * from ct
where ct.UT_AP_CustomerStatus == 1
outer join * from dir
where dir.RecId == ct.Party
&& dir.Partition == ct.Partition
outer join * from party
where ct.Party == party.Party
outer join * from ab
where party.AddressBook == ab.RecId
&& ab.Name == ''
{
ctr++;
}
info(strFmt('Finished with %1 rows selected',ctr));
}
When this runs, it ALWAYS returns 2,346 rows, which is how many rows are in CUSTTABLE.
However, when I run the below SQL in SSMS, it ONLY returns one row, like it should!
SELECT *
FROM [DYNAMICS_AX].[dbo].[CUSTTABLE] ct
LEFT OUTER JOIN [DYNAMICS_AX].[dbo].[DIRPARTYTABLE] dir
ON dir.RECID = ct.PARTY
AND dir.PARTITION = ct.PARTITION
LEFT OUTER JOIN [DYNAMICS_AX].[dbo].[DIRADDRESSBOOKPARTY] party
ON ct.PARTY = party.PARTY
LEFT OUTER JOIN [DYNAMICS_AX].[dbo].[DIRADDRESSBOOK] ab
ON party.ADDRESSBOOK = ab.RECID
WHERE ct.UT_AP_CUSTOMERSTATUS = 1
AND ab.NAME IS NULL
I'm fairly new at x++, so be gentle! Can anyone see what's wrong with the x++ query vs. my SQL statement?
Thanks, Craig
*This post is locked for comments
I have the same question (0)