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)

Apply filter on in-memory table after populating

(0) ShareShare
ReportReport
Posted on by 1,210

hi,

I want to apply filter on in-memory table after populating base on condition if(fund999 && sum(difference)==0.00) where sum(difference) is aggregated function.

I also have other question can we change the query dataset on run time.?

can we filter in-memory table from  report process class after papulating.?

can we handle this logic on ssrs design mode. where we can add filters on row group properties .. em adding [sum(difference)]=0.00 but this is also not filtering .

please also explain where is best place to handle this logic.

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    Brandon Wiese Profile Picture
    17,788 on at

    Conditions on aggregate fields like that are part of the HAVING clause of an SQL statement.

    But, if that's giving you trouble, you can always spool off the aggregate data into a 2nd temporary table, which can even be the same temporary table as the original data, and then you can spool and even delete from that 2nd temporary table as needed.

    In memory temporary tables require a lot of CPU resources to get their work done, so whether this is the "best" approach depends somewhat on how many records and how you need to access them.

  • AliViretechnologies Profile Picture
    1,210 on at

    hmm, you means fill the second temporary table first and then after populating second temp table value of second temp table into original table base on condition .

    e.g

    if(condition==true)

    {

       //fill data in orignal table

    }

    else

    {

    //=======fill data in temp table

    }

    //==========now after filling all table if condition is false===

    while select * from table group by columns where condition

    {

    //insert temp data to orignal data

    }

    can we change query object at run time ?

    can we filter directly in-memory table after populating?

    like

    SELECT AccountNum, AmountCurrencyCredit, AmountCurrencyDebit, ChequeDate,ChequeNum,Credit,CurrencyCode,

    Debit,sum(Difference),Fund999,InvoiceDate,InvoiceDesc,InvoiceNum,Name,Reversed,

    SettledDate,SettledVoucher,TraceNum,TransDate,Txt,Voucher

           from vendTransListTmp

           group by AccountNum, AmountCurrencyCredit, AmountCurrencyDebit, ChequeDate,ChequeNum,Credit,CurrencyCode,

    Debit,Fund999,InvoiceDate,InvoiceDesc,InvoiceNum,Name,Reversed,

    SettledDate,SettledVoucher,TraceNum,TransDate,Txt,Voucher

               where vendTransListTmp.Difference==0.00;

  • Suggested answer
    Brandon Wiese Profile Picture
    17,788 on at

    I'm not sure why you use (condition == true), but whatever mechanism you construct to take two passes at the data will work.

    You can change the query at run time, because you can use QueryBuild classes with temp tables.

    You can filter directly on in-memory temp tables.

    Your example SQL uses where vendTransListTmp.Different == 0.00 which will work, but could leave you with sum(Difference) that is still 0.00 because the where clause acts before the grouping, so if you have two transactions of -10 and +10 each they will net to 0.00.  You can deal with this using the having clause or by using a delete_from .. where Difference == 0.00 statement later.

  • AliViretechnologies Profile Picture
    1,210 on at

    Please give query filter example.

    on frontend ssrs design mode ventranslisttemp is grouped on [AccountNum] and [Voucher]

    I need to  sum(debit)-sum(credit)=0   where it is 0 remove that row. Following is simple query that is fatching all the row.

     SELECT AccountNum, AmountCurrencyCredit, AmountCurrencyDebit, ChequeDate,ChequeNum,Credit,CurrencyCode,

    Debit,sum,Fund999,InvoiceDate,InvoiceDesc,InvoiceNum,Name,Reversed,

    SettledDate,SettledVoucher,TraceNum,TransDate,Txt,Voucher

           from vendTransListTmp

  • Ahmet Coskun Profile Picture
    16 on at

    Thank you it worked.

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