In my previous two post we just learned how w just installed
Report Builder and then connect Report Builder with our ColdFusion server.
So, now it’s time to go for a simple example of ColdFusion
reporting using Report Builder. Please follow the steps to generate a tabular
report and use that in ColdFusion code.
Click on File
-> New in Report Builder, you will see a screen like below:
Go with “Report Creation Wizard” and click on “OK”.
You will see a next screen like below:
Click on “Query Builder” button.
Then we will see a new Query Builder screen for
our report.
As shown in the picture, you can see all the available data
sources and also you can write your own customize SQL query in the mentioned
section. There is button “Test Query”.
You can also test the query output by clicking that button. If your query has
any problem then it will display error message.
After writing your SQL query just click on “Save” button.
Then you will see another screen like below:
Here, you can select query columns which
you want to in printable report.By using right side "Up" and "Down" arrow you can place column in a defined order. For now just forget it and click on “Next”.
·
We will see another screen as below:
Here, you can define any order by fields in your report. Let
say I want to see first all arts which is not yet sold. By using the extreme
right Up and Down arrow you can define the direction of the order by clause. Here,
I want to see all sold items first so I made as descending order. It depends on
your choice.
Click on “Next” to go
to next screen.
·
Here is our next screen:
Just select the option as you see in screen and then click
on “Next”. You will see another
screen after that then click on “Next”.
·
You will see the next screen like below:
Here, in the text fields you have to put some descriptive
name about your report. See the label and put the description text accordingly
then click on “Finish”.
·
After, all these set up finally you see some
different window like below:
In this screen we can customize our report header text and
we can also format the display text in report.
Let’s see how we can do that:
First click on #1: A new window will pop up like below
Here, I have used ColdFusion DateFormat() to formatting the displaying date.
Click on #2: A new pop up window will be displayed:
Here, I just changed column header from “ISSOLD” to “Sold”. So similarly we can change all the column header with some
descriptive name.
Click on #3: A new pop up window will appear like below:
Here, we just used another ColdFusion function for display
formatting of a field value. Similarly, you can apply your own logic on other
fields if you want.
I have changed the column header and added display
formatting function for header and cell values. Finally we will have the following
screen:
Here, field names are changed and we can also see the
display formatting function in applied area then click on preview button to see the preview of
the report. Then save the report. It will generate a “.cfr” file.
Next, how we will use generated template in our ColdFusion code.
Go here...