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 CRM (Archived)

SSRS Report in CRM Date parameter validation error

(1) ShareShare
ReportReport
Posted on by

Hi,

I have a SSRS report on CRM 2011 with a date/Time parameter.  When I enter invalid input for the date parameter it gives me below error and the only option is to cancel the report. 

I want to handle this error on report and give user a error message and allow re-enter parameter values.

I added a seperate parameter as isValid and under default value wrote an expression to check date format using Regular expressions.

=System.Text.RegularExpressions.Regex.IsMatch(
IIf(IsNothing(Parameters!SessionDateStart.Value), "01/01/1999", Parameters!SessionDateStart.Value),
"(\d{2})\/(\d{2})\/(\d{4})"
)

And also I tried with custom code called on this separate parameter as bellow

=Code.ValidParams(Parameters!PaidDateValue)

function ValidParams(byval date as datetime) as boolean

if isDate(date) then
return FALSE
else
return TRUE
end if
end function

But each time the parameter itself throw above report before running the report.

Please suggest a solution

Thanks 

Matheesha

*This post is locked for comments

I have the same question (0)
  • Royal King Profile Picture
    27,686 on at

    check this post it may help to resolve

    geekswithblogs.net/.../validate-ssrs-report-input-parameters-the-proper-way.aspx

    http://nishantrana.me/2014/01/29/validating-input-parameters-in-ssrs/

  • Community Member Profile Picture
    on at

    Hi

    Thanks for the reply,

    But the first link is about checking date range and no mention about incorrect input handling. I tried writing custom code as it has done but incorrect input error for date parameter occur before executing custom code functions

    The second link suggest to use Text box parameter instead of Date type parameter to avoid the issue.

    I am looking for a date format validation mechanism for date type parameters.

    Any suggestion

    Thanks

    Matheesha

  • Aileen Gusni Profile Picture
    44,524 on at

    Hi Matheesa,

    If your parameter in SSRS is using date/time type, I think you don't need to validate anymore?

    What if you try using BIDS, got error or not?

    Thanks

  • Waqar Sohail Profile Picture
    on at

    Hi Mathesha, the Error message is report Validation Error. I think you don't need any further validation for the Date. As you can see In SSRS you can have this error if you enter wrong Date

  • Community Member Profile Picture
    on at

    Hi Aileen Gusni,

    Yes I am using BIDS. But the error message I get is as per the image I have attached.

  • Community Member Profile Picture
    on at

    Hi Waqar Sohail,

    The error message on SSRS is perfect. But when I upload this report to CRM 2011 and open it as a CRM report, I get the error message as per the image I have attached and it don't allow users to re enter values.

  • Suggested answer
    Waqar Sohail Profile Picture
    on at

    Hey Matheesha, Yes true report don't work after that. I had face similar issue so What I did to create four Parameters, Date, Month, Year and Hidden Date.

    2014_2D00_10_2D00_14_5F00_14_2D00_15_2D00_07.png






    So user can Select Date , Month and Year and you can set it to Hidden Date Parameters Defaults Value like

    =CDate(Parameters!Month.Value +"/"+Parameters!Day.Value+"/"+Parameters!Year.Value)

    Once user select the Year Or all the three parameters Hidden Date Parameter will get filled with the above expression. So only error user will face is required three parameter not get selected but can still run the report.


     

  • Community Member Profile Picture
    on at

    Hi,

    Yes you have work around the problem,  But in my case I have many parameters including date ranges. Eg: CompanyStartDate,  CompanyEndDate etc. And in such it is difficult and unclear to use a method as you suggest.

    Any suggestion

  • Aileen Gusni Profile Picture
    44,524 on at

    Hi Matheesha, using BIDS you also got error or the error comes if you run report from CRM?

  • Community Member Profile Picture
    on at

    I got this error while using BIDS, I set up BIDS long time ago.

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 CRM (Archived)

#1
SA-08121319-0 Profile Picture

SA-08121319-0 4

#1
Calum MacFarlane Profile Picture

Calum MacFarlane 4

#3
Alex Fun Wei Jie Profile Picture

Alex Fun Wei Jie 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans