Quantcast
Channel: Microsoft Dynamics 365 Community
Viewing all articles
Browse latest Browse all 17314

How to use Joins in AX

$
0
0

Today I will demonstrate you that how to use various type of joins in AX.

Exist Join

static void selectExistsJoin(Args _args)
{
CarTable carTable;
RentalTable rentalTable;
;
while select carTable exists join rentalTable
where rentalTable.CarId == carTable.CarId
{
info(strfmt("CarId %1 has a matching record in rentalTable", CarTable.CarId));
}
}

Not Exist Join

static void selectNotExistsJoin(Args _args)
{
CarTable carTable;
RentalTable rentalTable;
;
while select carTable notexists join rentalTable
where rentalTable.CarId == carTable.CarId
{
info(strfmt("CarId %1 does not has a matching record in rentalTable", CarTable.CarId));
}
}

Outer Join

static void selectOuterJoin(Args _args)
{
CarTable carTable;
RentalTable rentalTable;
;
while select carTable outer join rentalTable
where rentalTable.CarId == carTable.CarId
{
if (!rentalTable.RecId)
info(strfmt("No rentals for the car with carId %1", carTable.CarId));
else
info(strfmt("RentalId %1 is a %2 %3", rentalTable.RentalId, carTable.CarBrand, carTable.Model));
}
}

Viewing all articles
Browse latest Browse all 17314

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>