web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

check if at least one record exists

(0) ShareShare
ReportReport
Posted on by

Hi I a problem and try to create a statement as simple and quick as possible to solve it.

There are 4 Tables (A, B, C, D). C and D are header-line related tables, means C has the headers for D in it.

A has a relation to B and C, B has relation D (and for sure to A)

Now I want to check if there is at least one record in B where relations in tables A and C do not match

*This post is locked for comments

I have the same question (0)
  • Community Member Profile Picture
    on at

    Basically you are right but currently I do have a knot in my brain

  • Community Member Profile Picture
    on at

    maybe you can give a short advice? currently a have no clue how to mix those 4 table

  • Community Member Profile Picture
    on at

    ok. there is big data in the tables so doing the "while select" is not a good idea in that case.

    And I am not sure if your Idea realy works (cannot follow it anyway).

    But thanks a lot

  • Suggested answer
    Community Member Profile Picture
    on at

    Hi,

    Create two methods in tables:  A and C.

    static boolean exist(SalesId  salesId)

    {

       if (!salesId)

       {

           return false;

       }

       return (select firstonly RecId from salesTable

                   index hint SalesIdx

                   where salesTable.SalesId == salesId).RecId != 0;

    }

    Use your Field ID (Relation between the tables)

    In the method ValidateWrite

    Create a new condition:

    If(Table.Exist(FieldID))

    return Ret =  CheckFailed("The record is in the table A");

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Martin Dráb Profile Picture

Martin Dráb 4 Most Valuable Professional

#1
Priya_K Profile Picture

Priya_K 4

#3
MyDynamicsNAV Profile Picture

MyDynamicsNAV 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans