How to get Name from DirPartyTable

Hi , i’m trying to get the name of a party by using this specified relation between dirpartyTable , VendTable , purchtable and VendPackingSlipTrans, what"s the wrong on the following job

static void GenerateName(Args _args)


str res;

DirPartyTable dirPartyTable;

VendPackingSlipTrans vendPackingSlipTrans;

PurchTable purchTable;

VendTable vendTable;

select firstOnly dirPartyTable


dirPartyTable.RecId ==vendTable.Party &&

purchTable.OrderAccount == vendTable.AccountNum &&

purchTable.PurchId == “000002” ;

//purchTable.PurchId == VendPackingSlipTrans.OrigPurchId;

if (dirPartyTable)


info(“done !”);

res = dirPartyTable.Name;


info(strFmt(“job says name’s == %1”, res));


dirPartyTable.Name is correct. The problem is that your query is completely invalid - for example, you refer to purchTable datasource, which doesn’t exist in the query at all. You need something like this:

select firstOnly Name from dirPartyTable
    join vendTable
        where vendTable.Party == dirPartyTable.RecId
        join purchTable
            where purchTable.OrderAccount == vendTable.AccountNum
               && purchTable.PurchId == "000002";