Breaking

Saturday, August 25, 2018

Set header information in SSRS Reports in Dynamics Ax 2012

Overview:-

In my one of project I required like below information in header Fromdate, Todate, Report run date and Page no out of total pages.

Copy paste below code and change your fields and Changes in Textbox Properties like HTML formatting.
For that Select your Textbox inside Expression and right click on it and go to Textbox property ON General Tab There are to Radio button one for Text and another for HTML Content Select HTML text. After that run your report and you will get.
="From Date : " & Format(Fields!FromDate.Value, "dd/MM/yyyy") & "
" &
"To Date : " & Format(Fields!ToDate.Value, "dd/MM/yyyy") & "
" &
"Report Run Date : " & FORMAT(Now(),"dd/MM/yyyy hh:mm:ss tt") & "
" &
"Page "&Globals!PageNumber &" of "&Globals!TotalPages 
Output :-
From Date : 01\01\2017
To Date : 01\01\2017
Report Run Date : 01\01\012017 12:00:00 PM
Page 1 of 2 

Note:- My recommendation is please set text alignment to Right, so you will batter format in Preview.
Formatting-1:

Let your expression be as it is coming from inside AX. Don't change it. Revert back everything to same as it was giving you time.
Next, right click your textbox and click textbox properties. Finally click on Number and change formatting there.
If you will copy formatting expression, as value, you will get "expression as value". 

Part 1:
First simply drag your field on design of SSRS. Don’t do anything with formatting. Let it display data, which is coming from AX. 

Part 2:
Now, when you are sure that data is coming on Report, and it just matter of formatting left, right click your textbox and click textbox properties. Finally click on Number and change formatting there.

Formatting – 2:
=Format(TimeSerial(0,0,Fields!starttime.Value),"hh:mm:ss tt") - 12 hour clock
=Format(TimeSerial(0,0,Fields!starttime.Value),"HH:mm:ss tt") - 24 hour clock
=Format(TimeSerial(0,0,Fields!FromTime.Value),"hh:mm tt") 
As you can change Hours, Minutes, Seconds as per requirements in your SSRS Report.

No comments:

Post a Comment

Thanks for your comment.