Skip to main content

Notifications

Announcements

No record found.

Finance | Project Operations, Human Resources, ...
Suggested answer

How to prevent records in below row in X++ ax 2012

Posted on by 1,055

Hi Guys,

I have develop a Form for get vendor Total payable and Total invoice . And there have two option which select one vendor  & All vendor .

Select one vendor option is working fine but in All option when data is is populating on the form ,  in PO Days column which record actual value is zero its not populating zero , its taking above row PO Days value - Like in below screenshot - 

3005.jpg

 

 Please suggest how to prevent above record value should not show in below record .

Thanks .

  • Suggested answer
    nmaenpaa Profile Picture
    nmaenpaa 101,156 on at
    RE: How to prevent records in below row in X++ ax 2012

    Assuming all fields on your form are coming from the same table, then I'm sure the form displays all fields correctly. But perhaps your temp table has some data in this field that you don't expect. Did you already debug your code to see what is really inserted in your table. Debugging is always a good way to see what your code does.

  • Naveen Mishra Profile Picture
    Naveen Mishra 1,055 on at
    RE: How to prevent records in below row in X++ ax 2012

    In my code not any display method .

    I have created only one temp table and fetching the data from vend table & vend trans table for Total payable and total invoice , And i am able to do this . here  i created one Real field which logic is like below

    public NQDPOFinalTmp populateRecordAll()

    {

       NQDPOTmp  DPO ;

       NQDPOFinalTmp  finaltmp;

       VendTrans  transation;

       VendTable  vendtable;

       Name categorystr = Category.valueStr();

       FromDate      _fromdate = FromDates.dateValue();

       ToDate      _toDate = ToDates.dateValue();

       Date d= prevYr(_toDate);

       delete_from DPO;

        while select * from transation join vendtable where transation.AccountNum ==vendtable.AccountNum &&

            transation.ApprovedDate >= _fromdate &&

              transation.ApprovedDate <= _toDate &&

              ((transation.Voucher like "*NAQ*") || (transation.Voucher like "*API*") ||

              (transation.Voucher like "*GJV*")||(transation.Voucher like "*APP*"))

          {

               DPO.VendorCode      = transation.AccountNum;

               DPO.VendorName      = transation.vendTableName();

               DPO.TotalPayable    = transation.AmountCur;

               DPO.Closed          = transation.Closed;

               DPO.VendGroup       = vendtable.VendGroup;

               DPO.ApprovedDate    = transation.ApprovedDate;

               DPO.Voucher         = transation.Voucher;

               DPO.insert();

       }

               update_recordSet DPO

               setting TotalInvoice = DPO.TotalPayable

               where DPO.ApprovedDate >= d && ((DPO.Voucher like "*API*") || (DPO.Voucher like "*NAQ*"));

           while select sum(TotalInvoice),sum(TotalPayable),VendorName,VendorCode,VendGroup from DPO

           group by DPO.VendorCode,DPO.VendorName,DPO.VendGroup

        {

            ttsBegin;

               finaltmp.VendorCode         = DPO.VendorCode;

               finaltmp.VendorName         = DPO.VendorName;

               finaltmp.TotalPayable       = DPO.TotalPayable;

               finaltmp.TotalInvoice       = DPO.TotalInvoice;

               finaltmp.VendGroup          = DPO.VendGroup;

            if(finaltmp.TotalPayable )

            {

                   finaltmp.DPODays      = DPO.TotalPayable/ minOne (DPO.TotalInvoice );

            }

    -----------------------------------------------------------------------------------------------------------------------------

    My above code is working fine and i am able to get data , but below i am just multiplying with 365 for DPO Dyas field .

    here the problem is if any record DPO Value is zero that row taking above record DPO Days field value.

            if(finaltmp.TotalInvoice)

                   finaltmp.Days         = finaltmp.DPODays*365;

                   finaltmp.insert();

            ttsCommit;

        }

        return finaltmp;

    }

  • nmaenpaa Profile Picture
    nmaenpaa 101,156 on at
    RE: How to prevent records in below row in X++ ax 2012

    It's quite difficult to say since we don't know how you have implemented your form.

    Is there any additional info that you could share with us? If someone asked your help with similar problem, what would you like them to show you?

    If you develop something and it's not showing you the expected data, the first things to look at are:

    - What did you develop? Could you share your code with us?

    - Is this field populated via display method, or is it bound to a data source field? What is in the display method? How are the form data sources related to each other?

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,280 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,235 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans