Print Page | Close Window

Building a Report Parameters Form

Printed From: IdeaBlade
Category: DevForce
Forum Name: DevForce Classic
Forum Discription: For .NET 2.0
URL: http://www.ideablade.com/forum/forum_posts.asp?TID=409
Printed Date: 11-Jun-2026 at 6:26am


Topic: Building a Report Parameters Form
Posted By: DataMan
Subject: Building a Report Parameters Form
Date Posted: 05-Sep-2007 at 9:02am
_popupControl();
I'm building a report parameter form that a user will pick data from different combo boxes and when the report runs it will filter the report data.
 
The question I have is...  The user will be able to pick 5 or 6 different parameters to choose from which will all be in different comboboxes on the form and all of these choices are coming from different tables.  How do I fill a combobox with data from more than one table using entites?
 
So I want a combo box on an unbound form to show Customer.ContactName,  OrderSummary.ID, OrderSummary.OrderDate, Product.ProductName.  It will display the Customer.ContactName and the valuemember will be OrderSummary.ID
 
Previously I would just create a stored proc and load the combobox with the data from the stored proc.  What's the proper way to do this with DevForce and Entities?
 
Thanks
 
 
 
 
 
 



Replies:
Posted By: lars-erik
Date Posted: 20-Oct-2007 at 2:51am

I have trouble with this too. I want comboxes on an unbound form to act as search criteria. Someone help



Posted By: Yaron
Date Posted: 19-Nov-2007 at 11:15am
a. you can still create a 'ReportFilterEntity' (hope you find a better name) using a Proc/View based entity.  the same will be for search criteria.


Posted By: lars-erik
Date Posted: 12-Dec-2007 at 11:34pm

Can you explain me how? You mean creating an 'FilterEntity' that holds my search criteria?



Posted By: GregD
Date Posted: 04-Jan-2008 at 11:54am

Lars-Erik:

I think he meant create a business class (named "FilterEntity", or whatever) based on a stored procedure that assembles whatever collection of data it is that you want from whatever sources you want, returning the result as a series of rows with a common structure.

However, I'm still not quite clear on what you're trying to.  From DataMan's original post, it appeared that he was want to populate a ComboBox with *names* of properties from different entities. But then when he said "It will display the Customer.ContactName and the valuemember will be OrderSummary.ID", I got lost, since the DisplayMember and ValueMember for a ComboBox need to be set to properties of the same entity.

If you can explain further what you want, I'll try to help.

Greg Dunn
IdeaBlade
 


Posted By: lars-erik
Date Posted: 08-Jan-2008 at 11:40pm
Let' say I want to search for invoices. In the top of the form I have search criterias that aren't related to each other. Let's say we have the following search criteria:
a) a combobox displaying statuses of the invoice. This is retrieved from a InvoiceStatus table with code and name.
b) an input textbox with customer Number. An output textbox showing the respective customer name.
 
Is it possible to create an FilterEnity to hold both of these two search criterias ? I don't want to use Stored Procedures.


Posted By: GregD
Date Posted: 09-Jan-2008 at 3:27pm
You should be able to turn the user's selections into clauses of an RdbQuery. Here's one that
retrieves Customers based on a city and company name specified at runtime by the end user's ComboBox selections:

private void DoQuery() {

string selectedCity = this.mCityCriterionComboBox.SelectedValue;

string selectedCompanyName = this.mCompanyNameCriterionComboBox.SelectedValue;

RdbQuery anRdbQuery = new RdbQuery(typeof(Customer));

anRdbQuery.AddClause(Customer.CityEntityColumn, RdbQueryOp.EQ, selectedCity);

anRdbQuery.AddClause(Customer.CompanyNameEntityColumn, RdbQueryOp.EQ, selectedCompanyName);

PersistenceManager pm = PersistenceManager.DefaultManager;

EntityList<Customer> customers = pm.GetEntities<Customer>(anRdbQuery);

}



Posted By: BillG
Date Posted: 08-Apr-2008 at 11:31am
Here is an even cleaner way to do it.  I created a class called EmployerQO which stands for Employer Query Object.
It looks like this.
 
public class EmployerQO
{
       private string _employerName = string.Empty;
       private string _employerNo = string.Empty;
       private string _status = string.Empty;
       private string _office = string.Empty;
 
      .... create properties (get/set) for each.
 
}
 
in my view class after the user fills in the search parameters and then clicks the find button, I call a method called RetrieveFilterFields which creates an EmployerQO object and then looks at each query field and builds the query object.  I then call the following myController.GetEmployers(qo) passing it the query object.
 
In my controller call I build an RdbQuery object and then for each non empty field in the EmployerQO object I do a
query.AddClause().  I call GetEntities passing it the query object.
 
There may be better ways of doing this, but it seems to work for me.
 
Bill
 



Print Page | Close Window