Newbie question about C/AL Table Query

NavDaveNavDave Member Posts: 13
Hi,

I'm new the nav programming world.
I would like to know how do you do a inner join equivalent in C/AL.

For example I would like to retrieve result from nav tables following this Inner Query:
SELECT A.Col FROM A
INNER JOIN B ON A.Id=B.Id
INNER JOIN C ON B.Cid=C.Id
Where C.Id = 433

How do you translate this query in C/AL?
I know how to work with one record table but not multiple related tables.

Thanks

Comments

  • skullaskulla Member Posts: 140
    We do not have join statement in C/AL code but one way to accomplish this is to set filter in first table and while looping apply the join expression filter on second table and if match is found do your processing.

    For ex:

    A.RESET;
    IF A.FINDSET THEN
    REPEAT
    B.RESET;
    B.SETRANGE("No.",A."No.");
    IF B.FINDFIRST THEN BEGIN
    // do your processing
    END;
    UNTIL A.NEXT = 0;
Sign In or Register to comment.