Vendor address from Address table

Hello,

Please help me to get a vendor address from Address table. I need to replace the method:

display Addressing vendAddress()
{
return vendTable.Address;
}

with something joining VendTable, DirPartyTable and Address table.

Thanks in advance!

P.S. This field is for the Bank Payment Advice report

What’s your version of AX?

It’s DAX 2009. Thanks for helping!

Why do you need a DirPartyTable when you have a direct relation between vendTable and Address table ( see the relations in Address table)

Use \Data Dictionary\Tables\Address\Methods\find (you can get the related address type record with this method)

Is this a standard method, if so you should analyze the impact of changing this method.

Thanks Kranthi. Our VendTable doesn’t have TableId field and we have to go thru DirPartyTable. So, it’s not standard. I’m not really strong with DAX, I’m more SQL/SSRS expert. In SQL I would say

select

v.ACCOUNTNUM, a.NAME, a.ADDRESS from VENDTABLE v inner join DIRPARTYTABLE d on d.PARTYID = v.PARTYID inner join ADDRESS a on a.ADDRRECID = d.RECID where a.TYPE = 10.

Please help me to accomplish this in DAX.

Martin,

Could you help me with this? Our VendTable doesn’t have addresses for all the vendors and the address needed to be on Payment Advice report.

It’s urgent request and I’m not strong with x++. And the VendTable doesn’t have all the keys to join to Address table, so it has to be join of 3 tables: VENDTABLE, DIRPARTYTABLE and ADDRESS.

What about something like this?

VendTable        vendor;
DirPartyTable    party;
Address          address;
int              partyTableId = party.TableId

select Name, Address from address
    where address.AddrTableId == partyTableId

    exists join party
        where party.RecId == address.AddrRecId

        join vendor
            where vendor.PartyId == party.PartyId;

That worked!! Thanks!! I jusr added AddressType=10 for RemitTo.

Thanks again Martin!!