Set 1 of the values in drop down list as selected option in the UI:
Retrieve selected Id or value to be process:
To get list of objects to be load in the drop down list dynamically:
I had this problem yesterday, my nightmare. First thing come into my mind is to back all my project files. As I have a lot of branches in TFS for different projects. I’ll share what I did to solve this issue.
1. Backup all projects. It takes a lot of time, but is worth it I think, just in case.
2. remove current workspace and reset the workspace to the current project folder. You can find it here. File -> Source Control -> Advanced -> Workspace.
3. Go to Source Control Explorer and get the latest version of your project.
4. Close the Visual Studio.
5. Go to the project folder in your local PC and replace the projects folder with the one you have backup.
6. Open the project in Visual Studio. All your newly added and uncheck-in files will be inside. Add them back to the project.
* This can be done unless there is no one updated the project in TFS while you are solving this issue, else you have to get latest version after adding your newly added files.
By default, crystal report will automatically display the page header in each page. But if there is more than one report, where now I have few subreports in a report where each subreport contain its own page header, it will not display the page header in a new page. I have tried to use this method and it works to display the page header for each subreport in each page.
In each of the subreports,
1. add a formula field.
3. Group by the formula field
Each page header will be display nicely in each page.
Basically my task is to create a page that display data in grid, able to filter (search), and print the data I retrieve from a stored procedure using NHibernate.
I will pass a filter with few parameter into the SP to retrieve the data to be display.
In xml file, I have added ‘sql-query’ query tag to query out the data. ‘query-param’ is the parameter to pass into the SP.
in .hbm.xml file:
<?xml version=”1.0″ encoding=”utf-8″?>
<hibernate-mapping namespace=”Domain.Entity” assembly=”Domain” xmlns=”urn:nhibernate-mapping-2.2″>
<class name=”Domain.Entity.ClientAccountReport, Domain” table=”ClientAccountReport_UI” schema=”dbo”>
<id name=”Id” column=”[Id]”>
<property name=”ClientCode” />
<sql-query name=”ClientAccountReport_UI” callable=”true”>
<query-param name=”ClientCode” type=”String”/>
<query-param name=”ClientRefTypeCode” type=”String”/>
<query-param name=”ActionType” type=”String”/>
<query-param name=”AuditDate” type=”DateTime”/>
<return-property column=”ID” name=”Id” />
<return-property column=”SalesPerson” name=”SalesPerson” />
<return-property column=”SalesPersonName” name=”SalesPersonName” />
<return-property column=”SalesPersonOpenDate” name=”SalesPersonOpenDate” />
<return-property column=”ClientAccountType” name=”ClientAccountType” />
<return-property column=”ClientCode” name=”ClientCode” />
<return-property column=”ClientName” name=”ClientName” />
<return-property column=”AppointCode” name=”AppointCode” />
<return-property column=”AppointName” name=”AppointName” />
<return-property column=”AppointPersonCreatedDate” name=”AppointPersonCreatedDate” />
<return-property column=”AppointPersonAmendedDate” name=”AppointPersonAmendedDate” />
<return-property column=”AuditDate” name=”AuditDate” />
<return-property column=”AuditRecordID” name=”AuditRecordID” />
<return-property column=”FieldName” name=”FieldName” />
<return-property column=”ActionType” name=”ActionType” />
<return-property column=”OldValue” name=”OldValue” />
<return-property column=”NewValue” name=”NewValue” />
<return-property column=”Remarks” name=”Remarks” />
<return-property column=”UserID” name=”UserID” />
<return-property column=”OpenDate” name=”OpenDate” />
<return-property column=”CloseDate” name=”CloseDate” />
<return-property column=”LastActiveDate” name=”LastActiveDate” />
<return-property column=”ClientDeleteDate” name=”ClientDeleteDate” />
exec [ClientAccountReport_UI] @ClientCode=:ClientCode, @ClientRefTypeCode=:ClientRefTypeCode, @ActionType=:ActionType, @AuditDate=:AuditDate
In Dao.cs class file
public void GetClientAccountReportByPage(IPage<ClientAccountReport> page, IList<IFilter> filters)
HibernateDaoHelp.SearchByPageForSP(page, “ClientAccountReport_UI”, filters);
In HibernateDaoHelp.cs class file
public void SearchByPageForSP(IPage<T> page, string hql, IList<FXBOSS.Utils.IFilter> Filters)
IQuery iQuery = this.GetSession().GetNamedQuery(hql);
if (Filters.Count > 0)
foreach (var obj in Filters)
if (obj.data.ToString().Trim().Length == 0)
IList<T> ListOfObj = iQuery.List<T>();
if (page.pageSize != -1)
var list = ListOfObj.Skip((page.pageNo – 1) * page.pageSize).Take(page.pageSize).ToList();
page.totalCount = ListOfObj.Count();
page.result = list;
var list = ListOfObj.ToList();
page.totalCount = ListOfObj.Count();
page.result = list;
In controller.cs file
private Page<ClientAccountReport> filterPage(Page<ClientAccountReport> Page, string filters)
The WordPress.com stats helper monkeys prepared a 2014 annual report for this blog.
Here’s an excerpt:
A San Francisco cable car holds 60 people. This blog was viewed about 370 times in 2014. If it were a cable car, it would take about 6 trips to carry that many people.
Lately I’m been involve in a lot of crystal reports and one of them is a cross-tab dynamic report which will grow vertically and horizontally. There are a lot of ways to do it. And I think the most easiest way is to use the cross-tab function in the Crystal report which directly pump in all your data and let the crystal report do the rest. Unfortunately, it is too late for me to realized there is such function to use, and I used the way of coding which will faced some challenges in the midst of preparing the format of data before putting it into crystal report and display it.
OK. Here is just something to share for those who wanna use such method to display your data. This is what I’ve done, and may not be the most efficient way to do. Btw, I’m using MVC c# and nHibernate for this case.
Below is the View in my database, which you can see where the report will be display according to do order ValueDate, BrokerName, and TradePLCcyCode.
And Below is the Crystal report format where data will be populated into and be display. I have created a sub report for this to make ease if next time there is a need of adding new extra report to this report. And the below diagram shows the section where data will be displayed. I have fix it to 10 rows for Currency, 6 Columns for Broker and Total. And yeah, it is group by ValueDate. These fields are also define in my dataset file(.xsd).
Now, we go to the coding part. Before I pump in my data from view to the report, I have to convert all the data from view into a datatable before assigning them row by row into an object. Below is the datatable generated from the view where all data are populated into. As you can see there are different ValueDate which we have to group them later.
Now is the challenging part where I have to split this ‘huge’ datatable into sections of smaller datatable to be displayed. So What I’ve done is, firstly I split it by ValueDate. It depends on how many ValueDate in my datatable.
Above code split the ‘huge’ datatable into smaller lists of datatables with different ValueDate. And from here, I will loop through the number of distinct ValueDate. However, the rows and columns may exceed what I’ve set in the Crystal report, so I have to split these smaller lists of datatables into the sections that fit in the report.
How to know how many section for my rows and columns? As above, I have set 6 rows and 10 columns. So a loop function is use to loop through the ‘huge’ datatable to do the following process:
1. splitting it into smaller datatables. It will split by rows then by columns.
E.g. table is 12 X 20, it will split into 4 smaller tables.
table is 12 X 10, it will split into 2 smaller tables.
2. assigning each smaller datatables in an object.
3. assigning all objects into a list of object.
After that, will pass this list of object into the crystal report to be print.
Below is a sample of the report generated.
solution: This error usually due to workspace getting corrupted especially when local workspace are configured. This error doesn’t allow you to view the source control explorer. To solve this and to re-use the same workspace, you have to rename the $tf hidden folder which will be created at the root of your local workspace mapped folder. * Pls don’t use this method if your code is merge from the branch to the trunk but not yet check-in to the trunk.
For further references: