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)

where clause in DP class dataset (SRSReportDataSetAttribute)

(0) ShareShare
ReportReport
Posted on by

Hi,

I am developing an RDP report where I am using regular tables to show my data. I want to do something like this in my getTableBuffer method:
select * from xyzTable where createdby == "curUserId";

It's not working. Can someone please sugges how to do it?

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    Martin Dráb Profile Picture
    237,967 Most Valuable Professional on at

    You have several problems there:

    1. You likely want have any user with ID curUserId. You probably intend to call curUserId() method instead of using string "curUserId".
    2. All records in the current instance of an RDP class are created by the current user, so what's the point of the condition?
    3. Filter data in processReport() before putting them into the table.
  • Suggested answer
    Vilmos Kintera Profile Picture
    46,149 on at

    Have you googled for examples? The first hit I could find clearly explains what to do: www.dynamics101.com/developing-ssrs-report-using-report-data-provider-microsoft-dynamics-ax-2012

    Your select statements seems wrong too in the where clause, you did not provide the table name as xyzTable.createdBy == curUserId()

    Update: Martin beat me to it :)

  • Community Member Profile Picture
    on at

    1. It was a typo Martin, ofcourse I am using curUserId() method not string.

    2. I can't make my table temp, rather I am using regular table and now imagine multiple users accessing report with different parameters at same time and table is being populated with data of different users. But I just need to show only user specific output to every user. That's what I want to achieve.

  • Community Member Profile Picture
    on at

    Vilmos, thanks for the reply. I know the basics of RDP and lil advance too. I just came across a requirement that I just explained above. I need to put a where clause in getTableBuffer() method - method with attribute SRSReportDataSetAttribute-. is it poosible?

  • Suggested answer
    Mea_ Profile Picture
    60,284 on at

    Hey Hafiz Usama,

    If you are using regular table AX will use currenttransactionId to show only relevant data for current report run. So you cannot have situation where 2 users can see same data, even more same user can't see data from 2 different report run because each report will generate unique transaction id and only records with this transaction id will be shown.

  • Community Member Profile Picture
    on at

    Ievgen, it isn't working in my case. In my case its working like, User A ran a report and it inserted 3 lines with id 1,2 and 3. And then User B ran report and it inserted id 4 and 5. Now it will show user A all ids 1,2,3,4,5.

    In my process report method, in the beginning I delete data that's only created by currentuser. All other data stays in the table and renders on report.

  • Mea_ Profile Picture
    60,284 on at

    It looks like you are reinventing a wheel.

    Can you post here you process report method ?

    And what is the base class for you report DP?

  • Community Member Profile Picture
    on at

    SRSReportDataProviderBase is the base class.

    Process report is 400 lines method, where I firstly delete all the lines created by current user and then insert the lines. After that I update the fields in the line. This is what I am doing.

  • Mea_ Profile Picture
    60,284 on at

    SRSReportDataProviderBase works only with temporary tables,

    SrsReportDataProviderPreProcess should be used to work with regular table.

    You can easily find\google examples how to use SrsReportDataProviderPreProcess.

    If you want to keep using SRSReportDataProviderBase  with regular table it's your choice however it is completely wrong way and no one would be able to help you because you should not do it in the first place.

  • Martin Dráb Profile Picture
    237,967 Most Valuable Professional on at

    Preprocessing, as Ievgen explained, can work with persistent tables, but it has a special purpose - to allow preparing all data before actually running the report, to avoid timeouts if the processing takes too long. It's the right technical approach if you insist on using a persistent table, but it's not the scenario you described - instead, you merely said that you "can't make" your temporary table. Please tell us why you can't.

    By the way, since there is also a solution for pre-processing based on TempDB, TempDB-based pre-processing is preferred.

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