New Posts New Posts RSS Feed: Building a Report Parameters Form
  FAQ FAQ  Forum Search   Calendar   Register Register  Login Login

Building a Report Parameters Form

 Post Reply Post Reply
Author
DataMan View Drop Down
Groupie
Groupie
Avatar

Joined: 26-Jul-2007
Location: Canada
Posts: 52
Post Options Post Options   Quote DataMan Quote  Post ReplyReply Direct Link To This Post Topic: Building a Report Parameters Form
    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
 
 
 
 
 
 
Back to Top
lars-erik View Drop Down
Newbie
Newbie
Avatar

Joined: 15-Oct-2007
Location: Norway
Posts: 19
Post Options Post Options   Quote lars-erik Quote  Post ReplyReply Direct Link To This Post 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

Back to Top
Yaron View Drop Down
Newbie
Newbie


Joined: 19-Jun-2007
Posts: 16
Post Options Post Options   Quote Yaron Quote  Post ReplyReply Direct Link To This Post 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.
Back to Top
lars-erik View Drop Down
Newbie
Newbie
Avatar

Joined: 15-Oct-2007
Location: Norway
Posts: 19
Post Options Post Options   Quote lars-erik Quote  Post ReplyReply Direct Link To This Post Posted: 12-Dec-2007 at 11:34pm

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

Back to Top
GregD View Drop Down
IdeaBlade
IdeaBlade
Avatar

Joined: 09-May-2007
Posts: 374
Post Options Post Options   Quote GregD Quote  Post ReplyReply Direct Link To This Post 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
 
Back to Top
lars-erik View Drop Down
Newbie
Newbie
Avatar

Joined: 15-Oct-2007
Location: Norway
Posts: 19
Post Options Post Options   Quote lars-erik Quote  Post ReplyReply Direct Link To This Post 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.
Back to Top
GregD View Drop Down
IdeaBlade
IdeaBlade
Avatar

Joined: 09-May-2007
Posts: 374
Post Options Post Options   Quote GregD Quote  Post ReplyReply Direct Link To This Post 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);

}

Back to Top
BillG View Drop Down
DevForce MVP
DevForce MVP
Avatar

Joined: 05-Dec-2007
Location: Monroe, MI
Posts: 233
Post Options Post Options   Quote BillG Quote  Post ReplyReply Direct Link To This Post 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
 
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down