Techie Talks

Thursday, September 08, 2005

Dynamic Crystal Report Generation - Day 2

Problem:
Well, it has been some horrible 24 hours since I started looking for a solution to totally dynamic crystal report generation. Even the omni-potent Google failed to help. All I found was frantic cries by people (some guy was even ready to buy a beer) to find a similar solution. I think its not a good idea to spend more time doing any more research on this, at least for the time being.

Solution (for now)
I, finally, am planning to create a report at design time with all possible fields pulled into it and then use the remove/edit method mentioned in the prev post to cull out unwanted columns. Also, to use a filter on what records are to be pulled, the following comes in handy:

string selectionFormula = "Mid({employee.emp_id}, 1, 1) = 'A'";
testReport.DataDefinition.RecordSelectionFormula = selectionFormula;

The above code snippet works kinda like a SQL select statement. It pulls only those records with employee ID's beginning with an A. I need to do more study on other filters. But thats only second in my list. My current to-do list is as follows:

1) Generate report with dynamic columns
2) Be able to position the seen columns properly when central columns vanish.
3) Be able to populate only required records.

Future Work
To be able to add columns dynamically (the issue that I am going thumbs-down for now). When is this "future"? No idea. "As time permits", to be politically correct!

0 Comments:

Post a Comment

<< Home