What is the link between LedgerTrans and LedgerJournalTrans in AX 2009?

When I open a voucher (transactions) screen from the posted Journal transactionsI can see in form DS that the LedgerJournalTrans and LedgerTrans are linked by Voucher and TransDate…

but when I look at the code, I can see that such joins usually have also additional criterias like Amounts(that I find bizzare). Plus on LedgerJOurnalTrans there is no standard method to find LedgerTrans . Neither LedgerTrans has a method to find LedgerJournalTrans that makes me all even more suspicious.

How do you usually write a query like that?

What are you trying to do? I don’t think there’s a 1:1 bidirectional relationship between those tables. There’s transactions that’ll end up in the ledger that didn’t come from a journal, right?

Hi Jacob. I’m trying to create a correct query finding LedgerTrans that are relevant to the current LedgerJournalTrans.
And yes, there can be transactions not coming from the journal and those tables are not 1:1

The voucher number and dataareaid should do it in 2009, I think. Was that not working?

Why do you need dataareaid??

what do you mean? in 2009, the ledgertrans table is company specific. the dataareaid is the company identifier and needs to be in almost all queries you’re going to run…

@jacob.roder thank you for trying to help, but your answer re dataareaid is wrong

My mistake. Is there not a dataareaid on those tables?

There is, but AX core adds dataareaid range automatically for the company-specific tables.

Oh, I’m sorry. You’re talking about a query directly in the AOT and not directly against the SQL database.

My apologies.