Click here to Skip to main content
15,885,915 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Populating an SSRS report from dyanmic dataset i.e. number column and order of columns may vary based on condition, and this report on trying to export to excel. But in exporting date format column filtration not working.

What I have tried:

Populating an SSRS report from dyanmic dataset i.e. number column and order of columns may vary based on condition, and this report on trying to export to excel. But in exporting date column filtration not working. Finds the reason is I bind the column in string format.

Sample data format to understand. Here the columns & order of columns may vary as per condition.

Name______DOB_________Country_______Gender
Tom-------15-May-90---India---------Male
Jerry-----5-Jun-94----India---------Male

Then I tried to convert DOB column to date time.

For converting DOB to date format changed return type of DOB from sql query as datetime, converted column value to date time using CDate() in SSRS and formatted in own format (dd-mmm-yyyy).

Below expression used for converting to date time
IIF((Fields!COL.Value="DOB") ,CDate(Fields!VALUE.Value),(Fields!VALUE.Value))

But showing #Error for columns data type other than date time.

Please advise solution
Posted
Updated 9-Oct-18 0:56am
v2

1 solution

Hi you apply the expression only on DOB column's data cell.


  • right click on the DOB column's bellow cell.
  • click on "Expression"
  • then type this expression:
    =CDate(Fields!VALUE.Value)


this expression will evaluate on DOB data.

i hope this will help you.
 
Share this answer
 
Comments
Jithin Geroge 9-Oct-18 8:09am    
Hi I tried same by below format.

IIF((Fields!COL.Value="DOB") ,CDate(Fields!VALUE.Value),(Fields!VALUE.Value))

But showing error '#Error' in columns other than data type date time.
JayantaChatterjee 11-Oct-18 4:02am    
Hi Jithin,
if you are using this expression on DOB column then you don't need to check the column name, because it always will the DOB column right.?

you said "showing error '#Error' in columns other than data type date time.":-
is your DOB columns may have different values (which is not date time)?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900