Nate Lowrie wrote:
> I am using a grid to display a list of customers, the customer info
> includes first name, last name, address, City, State, and Zipcode.
> The city and state fields are located in a zipcode table which uses
> the zipcode (int) as a primary key. The rest of the info is in the
> customer table, including a zipcode as a foreign key. I want to
> display the customer list in a grid and limit the results to 50 shown.
>
> How do I get 2 bizobjects to function as the datasource for the grid?
> I am a little lost here as this is the first time I am using the grid
> for anything and I am still shaky with BizObjects. The dGrid_test
> does not use bizobjects and sets the dataset, so it is limited in use
> to me. An example would be of great. Thanks.
Don't use 2 bizobjs, just join the tables in your sql. IOW:
biz.UserSQL = """
select customers.first_name,
customers.last_name,
customers.address,
zipcodes.city,
zipcodes.state,
customers.zipcode
from customers
inner join zipcodes
on zipcodes.zipcode = customers.zipcode
order by customers.zipcode, zipcodes.state, zipcodes.city
limit 50
"""
In your real code, you'll want to use the sqlbuilder functions such as
addField(), addJoin(), addWhere(), etc. but I wanted it to be clear what
we are doing here. You can't set UserSQL and then add a where clause so
UserSQL is of limited usefulness unless you add more code yourself.
Then if the user changes the value of the zipcode field, you'll either
want to requery the dataset or just fetch the new city, state from the
zipcode table for that record.
Paul
--
http://paulmcnett.com
_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-users
Searchable Archives: http://leafe.com/archives/search/dabo-users
This message: http://leafe.com/archives/byMID/dabo-users/[EMAIL PROTECTED]