简体   繁体   中英

Pass expression as parameter to Dataset in SSRS

In FetchXml Query I have end date being passed as parameter but for Start Date the parameter is based on user selection. For example, a user can select as MTD, QTD and YTD as reporting time. So if user select QTD as start date and End Date is select some date in February like 25th. So I need to pull records that were created from Start of the quarter to the selected date in end date.

What I can do I make parameter but its values are fixed in a sense what if the user is interested to select date form last year.

The way around is to use textbox and get sorted the start date based and selected value and pass this new expression as parameter to dataset.

These are just assumption, I would like to hear form gurus to get this query sorted out.

Below is my FetchXml query:

<fetch version="1.0" output-format="xml-platform" mapping="logical" distinct="true" >
    <entity name="account" >
        <attribute name="name" />
        <attribute name="address1_telephone1" />
        <attribute name="fax" />
        <attribute name="accountid" />
        <order attribute="fullname" descending="false" />
        <filter type="and" >
            <condition attribute="createdon" operator="on-or-after" value="" />
            <condition attribute="createdon" operator="on-or-before" value="" />
        </filter>
    </entity>
</fetch>

You can use specific FetchXML Operators for each of your query types:

MTD: this-month
QTD: this-fiscal-period
YTD: this-year

For example:

<filter type="and" >
    <condition attribute="createdon" operator="this-month" />
</filter>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM