OpenOffice.org Forum at OOoForum.orgThe OpenOffice.org Forum
 
 [Home]   [FAQ]   [Search]   [Memberlist]   [Usergroups]   [Register
 [Profile]   [Log in to check your private messages]   [Log in

Help with Subforms, please.

 
Post new topic   Reply to topic    OOoForum.org Forum Index -> OpenOffice.org Base
View previous topic :: View next topic  
Author Message
CitriQ
Guest





PostPosted: Sat Nov 22, 2003 3:26 am    Post subject: Help with Subforms, please. Reply with quote

Hi :-)
I am going to try to explain my needs and if any of you have a little time to help me, I will be greatly pleased.

I have a little informatic/audio Shop. I donīt know too much about databases, but I have created an acces driver on the ODBC Controller of winXp and added some registers from inside the "data sources" inside Open Office. Then, I have an unique table of components with the following fields:

Components Table:


- ID (Primary ID)
- Type (Motherboard, CPU, Case, Videocard, ...)
- Brand (Asus, AMD, Intel, Pioneer, ...)
- Model (A7N8X, XP2600+, Barracuda, ...)
- Description (Product description)
- Price (Componentīs price)
- Provider (Componentīs provider or distributor)

Example of some registers:

ID, Type, Brand, Model, Description, Price, Provider
---------------------------------------------------------------
1, Motherboard, Asus, A7N8X, SocketA-Nforce2 Ultra 400, 95.00, Ingram Micro
6, HD, Seagate, Barracuda 120 GB, 7200 rpm/8MB/120GB, 86.35, DataTech
...

Then, my needs are, that I want to make the orders with forms, selecting 1 product each line, but to select the product, I would like, first to select a "Type", then a "Brand" and to finish, select a "Model" and the rest of fields will be filled automaticaly. But I would like to filter this way: Whe I select a "Type" like, i.e. "Motherboard", The next listbox should only list the brands that contains the world "Motherboard" in its "Type" field, I mean, If I have different brands like, AMD, ASUS, MSI, Toshiba, Western Digital, Lian-li,... when I select "Motherboard" in the field "Type", the next list box that will contain the list of brands, should only contain those brands that makes Motherboards, like Asus and MSI.

Is suppossed that I have to use subforms, but I am following the help's instructions and I donīt get it. I am doing that:
I make a form called "first" with a listbox inside called "TypeSel". This listbox have the following properties:
- Data Field: Type
- Type of List Content: SQL
- List content: SELECT DISTINCT `Type` FROM `Components`

Inside this form there is a subform called "second" and with the following properties:
- Data Source: CitriQ (Name of the data source)
- Type of content: SQL query
- Content: SELECT DISTINCT "Brand" FROM "Components" WHERE "Type" = :x
- Link master fields: "Type"
- Link slave fields: "x"

Even if I have nothing inside this subform, when I try to change the "Design Mode" to test the form, I get the next error: Invalid descriptor index

I am working with OpenOffice 1.1 final.

Any help will be appreciated.
Thanks in advance :-)
Back to top
dfrench
Moderator
Moderator


Joined: 03 Mar 2003
Posts: 1605
Location: Wellington, New Zealand

PostPosted: Sat Nov 22, 2003 10:55 pm    Post subject: Reply with quote

I assume that you are creating line item rows of an order by selection from an inventory. I would expect to have at least the following tables:
ORDER (Order Id and Customer Details)
LINEITEM(OrderID, LineItem# , Qty, Inventory details)
INVENTORY (that's yor COMPONENTS)

If your order creation process needs all of this as a single display, ORDER & LINEITEM follow the Form, Subform relationship that you have seen documented. INVENTORY is another top level form.
I visualise your inventory item selection procedure as follows.
There are 2 list boxes to progressively narrow down the choice by type and brand and the remaining data in a grid control (could stick to a grid control for everything)
The grid control has a filter or SQL specification referencing the values in the two listboxes.
The brand list box has a SQL specification like you suggested SELECT DISTINCT Brand FROM Components WHERE Type = LISTBOX1.VALUE
When the data changes in the first list box (eg you select "Motherboard") refresh the second listbox control (You may have to create separate forms for each of the list boxes and the grid to do this ... I use form.reload()).
Similarly when the data changes in the second listbox refresh the grid.
When you select the actual inventory line, you can then INSERT the new LINEITEM row using the data items from the 2 listboxes and the grid.
Database purists would no doubt create separate Tables for each of BRAND and TYPE.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    OOoForum.org Forum Index -> OpenOffice.org Base All times are GMT - 8 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group