Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Answered

populate tmp table from select statement then use it to populate another tmp table using query rdp

(0) ShareShare
ReportReport
Posted on by 47

Dear All,

I CREATED THIS PROCESS REPORT METHOD TO populate data on a temp table using select statement and then populate it to another temp table using query functions , but it can't populate my second temp table yet , would someone please help?

public void processReport()
{
    ADVChecks                     AdvChk  ;
    ADVCHKCheckStepsActual        AdvChekStpActul ;
    SG_NotesReceivableTmp       tmp ;
    
    TransDate                     NotesDate;
    ADVCHKStepID                  StepId ;
    ADVCHKStepType                Steptype ;
    ADVCHKStepGroupID             StepGroup ;
    ADVCheckGroupID               CheckGroup ;
    ADVCHKStepSequence              advseq ;







        // Query

        Query                   query;
        QueryRun                qr;
        QueryBuildDataSource    queryBuildDataSource , qbds , qbd;
        QueryBuildRange         queryBuildRange , qbr;
        QueryFilter  qf ;
        SG_NotesReceivableContract_Q    Contract ;

   Contract = this.parmDataContract();
   
   TmpDB.ADVCheckID 
   
   

    while Select AdvChk // 'Check_11-000010759'

    {

       while  select firstOnly AdvChekStpActul
        order by AdvChekStpActul.ADVCHKStepSequence desc
        where   AdvChekStpActul.ADVCheckID == AdvChk.ADVCheckID
          &&   AdvChekStpActul.TransDate <=  NotesDate
          &&   AdvChekStpActul.TransDate
          &&   AdvChekStpActul.Applied == 1

        {



        TmpDB.CustAccount =         AdvChk.CustAccount ;
        TmpDB.CustName =            AdvChk.CustName ;
        TmpDB.AmountCur =           AdvChk.AmountCur ;
        TmpDB.ADVNetAmount =        AdvChk.ADVNetAmount ;
        TmpDB.ADVCheckSource =      AdvChk.ADVCheckSource ;
        TmpDB.ADVCheckGroupID =     AdvChk.ADVCheckGroupID ;

        TmpDB.ADVCHKStepType =      AdvChekStpActul.ADVCHKStepType ;
        TmpDB.ADVCheckID =          AdvChekStpActul.ADVCheckID ;
        TmpDB.Voucher   =           AdvChekStpActul.Voucher ;
        TmpDB.ADVCHKStepID =        AdvChekStpActul.ADVCHKStepID ;
        TmpDB.TransDate =           AdvChekStpActul.TransDate ;
        TmpDB.ADVCHKStepGroupID =   AdvChekStpActul.ADVCHKStepGroupID ;
        TmpDB.ADVCHKStepSequence =  AdvChekStpActul.ADVCHKStepSequence ;
        TmpDB.LedgerName        =   DimensionAttributeValueCombination::getDisplayValue(AdvChekStpActul.LedgerDimension);
        TmpDB.LedgerDimension   = AdvChekStpActul.LedgerDimension ;



        TmpDB.insert() ;


            }
 }

     query = new Query();
      queryBuildDataSource = query.addDataSource(tablenum(SG_NotesReceivableTmp));
    
   qr = new QueryRun(query);
    qr.setRecord(tmp);
   
    while (qr.next())
    {
        tmp = qr.get(tablenum(SG_NotesReceivableTmp));
        
         TmpDB2.CustAccount =         tmp.CustAccount ;
        TmpDB2.CustName =            tmp.CustName ;
        TmpDB2.AmountCur =           tmp.AmountCur ;
        TmpDB2.ADVNetAmount =        tmp.ADVNetAmount ;
        TmpDB2.ADVCheckSource =      tmp.ADVCheckSource ;
        TmpDB2.ADVCheckGroupID =     tmp.ADVCheckGroupID ;

        TmpDB2.ADVCHKStepType =      tmp.ADVCHKStepType ;
        TmpDB2.ADVCheckID =          tmp.ADVCheckID ;
        TmpDB2.Voucher   =           TmpDB.Voucher ;
        

        TmpDB2.insert() ;


    }

}
        

  • nmaenpaa Profile Picture
    101,158 Moderator on at
    RE: populate tmp table from select statement then use it to populate another tmp table using query rdp

    Could you please mark the helpful answer(s) as verified? Thanks! 

  • m.salah297 Profile Picture
    47 on at
    RE: populate tmp table from select statement then use it to populate another tmp table using query rdp

    Dear all thanks it's done

  • Verified answer
    Martin Dráb Profile Picture
    233,396 Most Valuable Professional on at
    RE: populate tmp table from select statement then use it to populate another tmp table using query rdp

    For reference, this is clearly about the same thing as the thread filter a query after setting range. Here m.salah297 just decided not to use a query at all.

  • m.salah297 Profile Picture
    47 on at
    RE: populate tmp table from select statement then use it to populate another tmp table using query rdp

    because i want to filter the second one through query and i can't get the same filter on the first one through query

  • nmaenpaa Profile Picture
    101,158 Moderator on at
    RE: populate tmp table from select statement then use it to populate another tmp table using query rdp

    Why can't you populate both temp tables at the same time?

    Anyway, when using temp tables with Query class, you must use QueryRun.setRecord(yourTempTable).

    www.schweda.net/blog_ax.php

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

🌸 Community Spring Festival 2025 Challenge Winners! 🌸

Congratulations to all our community participants!

Adis Hodzic – Community Spotlight

We are honored to recognize Adis Hodzic as our May 2025 Community…

Kudos to the April Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard > Finance | Project Operations, Human Resources, AX, GP, SL

#1
Abhilash Warrier Profile Picture

Abhilash Warrier 254

#2
Martin Dráb Profile Picture

Martin Dráb 230 Most Valuable Professional

#3
Adis Profile Picture

Adis 169 Super User 2025 Season 1

Overall leaderboard

Product updates

Dynamics 365 release plans