Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics AX (Archived)

How to table data? how to write query

Posted on by 100

I have table name A in

AID
1252
1253

 Table A

AID BId
1252 426
1252 427
1253 471
1253 472

Table B

BId name
426 nava
427 lava
471 java
472 rava

Table C

Here how can i get all names in C Table am getting only two names how to query

*This post is locked for comments

  • MYGz Profile Picture
    MYGz 1,858 on at
    RE: How to table data? how to write query

    Damn! Edit button not working on Android so adding another comment instead.

    If you are able to get desired result with crossCompany, kindly understand it's working and whether you should use the cross company table records for further processing in your code. Ideally each record should be processed in its own company due to various underneath business logic and validations.

  • MYGz Profile Picture
    MYGz 1,858 on at
    RE: How to table data? how to write query

    CHECK if this logic works.

    While select TableA join TableB where TABLEA.AID==TABLEB.AID join TableC where TABLEC.AID==TABLEB.AID

    {

       info(TABLEC.NAME);

    }

    Also if you are checking the data from SQL, Kindly check if the DATAAREAID of all records are same, otherwise use "crossCompany" keyword in the query if they are not to get the desired result.

  • Suggested answer
    venu123 Profile Picture
    venu123 100 on at
    RE: How to table data? how to write query

    actually it should return two lines but it's not returning

  • Martin Dráb Profile Picture
    Martin Dráb 230,198 Most Valuable Professional on at
    RE: How to table data? how to write query

    I don't know your data, therefore I can't comment on how many records the query should return. But I suspect that you didn't debug the problem correctly. I assume that the query returns multiple records, but your code inside the loop overwrites the same productReceiptTmpLine record over and over and you end up with inventSerialId and inventBatchId of the last transaction.

    Please use the debugger to verify whether it's the case.

  • Suggested answer
    venu123 Profile Picture
    venu123 100 on at
    RE: How to table data? how to write query

    Here i suppose get multiple lines in report but am getting one line only how to write query

  • venu123 Profile Picture
    venu123 100 on at
    RE: How to table data? how to write query

    pastedimage1565672298798v1.png

  • Suggested answer
    venu123 Profile Picture
    venu123 100 on at
    RE: How to table data? how to write query

          while select inventtrans

           where vendPackingSlipTrans.PackingSlipId==inventTrans.PackingSlipId

             join inventDim

           where  inventtrans.inventDimId==inventDim.inventDimId

           {

                productReceiptTmpLine.inventSerialId   =        inventDim.inventSerialId;

            productReceiptTmpLine.inventBatchId    =        inventDim.inventBatchId ;

           }

    Actually this but am not getting multiple lines only one line is coming for one serial  number

  • Martin Dráb Profile Picture
    Martin Dráb 230,198 Most Valuable Professional on at
    RE: How to table data? how to write query

    You mention getting data from table C only, but why did you show the other tables? Don't you want to join all three tables?

    Regarding why your current code returns only two records, you'll have to show us your code. Finding bugs in unknown code is very difficult. Also, please tell us which two names are returned.

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,269 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,198 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans