Well, you say you’re not using a library, but I would recommend that
you try my MyActiveRecord class for this. You can be up and running
in very few lines of code.
I just did an experimental update to the library that allows you to
get around the one and only requirement – that your unique ID is
named ‘id’. If you can post a quick schema of your data with the
columns you want to iterate over noted, I am sure that Todd or I
could give you the basics in one e-mail or two.
Walter
On Jun 7, 2010, at 2:32 PM, David Ledger wrote:
I need to write an action that will will duplicate a
, or
possibly a tr> n times depending on database queries. Each
or
tr> will have to contain a mix of calls for database content.
I’m not using anyone’s library. I will have to call php for each
data item. The data is far too complex for any off the shelf
solution.
I’ve been going through the docs and have made a couple of trivial
actions. The one covering a repeated uses [Repeat] …
[/Repeat] without saying what this represents, so I can’t get any
further.
The docs imply that what I want to do is possible, but assume long
familiarity with Action writing.
Where should I start looking?
Thanks Walter.
It’s not the data extraction that escapes me, although I’ll have to
look more deeply into MyActiveRecord, it’s how to get multiple
products to appear in a Freeway page.
A ‘quick schema’ isn’t that simple. There are over 130 fields, but
the majority of these are to do with prices at different quantity
levels and the prices of optional extras - also at different quantity
levels.
The database was generated from a FileMaker database that had a lot
of repeated fields. It was exported as html and that was parsed into
mySQL. Because of that it’s not a well designed database for mySQL.
If I were a database expert designing it from scratch I’m sure I
wouldn’t end up with what I have.
Each row is a product, which may have options. There is a product
code field (Code), a product name (Name), a product description
(Description), a supplier (Supplier), a product range (Range), a
product finish (Finish), a pointer to a jpg, and a database index
(idx, like ‘id’), There are also several cost fields and their
corresponding price break quantities, and up to 18 options, each with
space for several costs and price breaks. Each option also has a type
that determines how information about is is to be extracted from the
database.
Options come in three main types. One is another product that is also
available by itself and has a db entry, but is normally supplied
along with the main product. The second is build-time option that
incurrs an extra cost. The third is a build-time option (or choice)
that has no extra cost.
Options that are also products in their own right have an option type
indicating a ‘link’ and consist of a name and the product code of
that product. Most of these were repeated option fields in the
original FileMaker that have been pulled out on their own.
Build-time no-cost options are included in the Finish field, which is
tinytext. They are specified in much the same way as CSS, and can be
parsed to give the name of a popup menu and the options within it.
Some of these will also have to trigger a floating pane illustrating
sub-options.
Cost options just populate one of the 18 sets of option fields. The
no-cost options are done differently because some records would
require over 200 sets of option field groups. That was the way things
were heading while it was still in FileMaker.
When showing one product, all the options will have to be extracted
and added to the page in various ways. This I can cope with (or
should be able to).
When showing a range of similar products, only the main fields of
Code, Name and the jpg need to be shown. But I need to show many on
one page. This I don’t see how to do.
The current website is a ‘cataloge’ website rather than the
‘Quotation’ website we are aiming for. It’s all Freeway, but hand
generated. Because it’s hand generated there are some
inconsistencies, but that’s not surprising for a site of this size.
It’s at http://www.kirkhouse.co.uk/. There isn’t even an early
version of the new one yet.
David
–
David Ledger - Freelance Unix Sysadmin in the UK.
HP-UX specialist of hpUG technical user group (www.hpug.org.uk)
email@hidden
www.ivdcs.co.uk
dynamo mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options