this part is a fairly big undertaking.
First, lets think about the work flow and how the tables relate:
you have 3 pieces:
1-The OptionGroup
2-The Option Name
3-The Product
the Option Name relates to the option group
First you create an option Group, then add an option name to that group.
The option group and option name are completely separate from the product.
using the productoptions table, you can "assign" an option name to a product.
an option name can be assigned to multiple products, and effect the price differently on each because of the productoptionPriceIncrement column
-------
so onto creating the product insert:
1) you need to have a page to enter new Option groups, this is a simple page, with one form element on it:
Group Name:
use the Data Assist Insert Record behavior to insert the group name into the optiongroups.optiongroupName column.
2) You need another page to create option names. The option name needs to relate to the optiongroups table.
This page will have two form elements:
OptionGroup - Select List
OptionName - text Box
For the option group Select list, create a recordset:
rsOptionGroups:
SELECT * FROM optiongroups
set the OptionGroup select list to be dynamic, use the optiongroups.optiongroupID column for the value and the optiongroups.optiongroupName for the label.
The DataAssist Inssert Record server behavior will store the option group in the options.optionOptiongroupID column and the OptionName in the options.optionName
3) Then Use DataAssist to create pages for managing the product table. I would use the product detail page manage product options for the selected product.
You need to have a form with 4 elements:
OptionGroup - Select list
OptionName - Select List
PriceIncrement - Text Box
productID - hidden Form Element
create a recordset for the option groups:
rsOptionGroups:
SELECT * FROM optiongroups
set the OptionGroup select list to be dynamic, use the optiongroups.optiongroupID column for the value and the optiongroups.optiongroupName for the label.
Create a recordset for the option names:
rsOptionNames:
SELECT * FROM options
Here you need to use dynaic Dropdowns to populate the OptionName select list.
Use the Create Dynamic Array Server behavior, use the rsOptionNames recordset. set the parent ID to the optionOptiongroupID column. The child ID to the optionID column and the Child text to the optionName column
In design View, select the OptionGroup select list, on the Bindings Panel, click the plus button and select WA Dynamic Dropdowns -> Populate List From Array. use the OptionGroup as the parent list and the OptionName as the child list.
For the productID hidden Form Element, bind to the Product ID column from the WAProduct recordset.
you then need to add a DataAssist Insert record behavior to the page for the productoptions table.
Bind the productoptionOptiongroupID column to the OptionGroup select list.
The productoptionOptionID column to the OptionName Select List.
the productoptionPriceIncrement column to the PriceIncrement Text Box.
and the productoptionProductID column to the productID hidden Form Element.