Hi I have a select statement in X++ that I'm using to try to sum up all the ledger entries tied to a specific InventPosting record. The problem I'm finding is LedgerDimension on inventPosting doesn't tie directly to generalJournalAccountEntry. I know I have to do something with the dimensionStorage class to get the proper relationship but I'm not sure how to do that.
Here's my select below:
Select sum(AccountingCurrencyAmount) from generalJournalAccountEntry
join RecId from generalJournalEntry where generalJournalEntry.Recid == generalJournalAccountEntry.GeneralJournalEntry
join RecId from subledgerVoucherGeneralJournalEntry
where subledgerVoucherGeneralJournalEntry.GeneralJournalEntry == generalJournalEntry.Recid
&& generalJournalAccountEntry.LedgerDimension == InventPosting.LedgerDimension <-- this doesn't work.
Finally, I would like to also add in InventSite to this select.
Ideally, I'm looking for a select that sums up the AccountingCurrencyAmount from the generalJournalAccountEntry where the dimensions are tied to a specific InventPosting Account and a specific InventSite dimensions.
Any ideas?