Akopia Akopia Services

[Date Prev][Date Next][Thread Prev][Thread Next][Minivend by date ][Minivend by thread ]

[mv] search one database - display unique, sorted items from another



******    message to minivend-users from "Curt Hauge" <chc@mninter.net>     ******

Hi list!

I am (still) a newbie and follow this list regularly. This list is an
excellent source of support and information to me. I am trying to display a
list of records which are unique, and which are sorted alphabetically. The
trouble is that I am searching one database for certain criteria, and
displaying the contents of another database, based on data from fields in
the searched database. After reading the docs, and spending many hours on
this, it seems that (the only way?) to do this is to use perl (my perl is
poor, at best =). If I need some kind of perl script, where should it be
implemented in my code? I am throwing it to the minivend scholars (you all
know who you are =)to see if you can give me ideas or at least point me in
the right direction (keywords to search docs, etc.). Of course, I have
searched the docs and mail archives for 'unique' and 'sort'. Also, is
mv_dict_order an option? If so, I am not sure how to use it properly.

Here is my code (MV4.02, Linux Mandrake 6.0):

Users select multiple 'ingredients' from a drop down list:

<FORM ACTION="[area search]">
			<SELECT NAME=mv_searchspec Size=10 Multiple>
			[loop search="fi=ingred/ra=yes/ml=9999/tf=item/to=f"]
			<option value="[loop-data ingred code]">[loop-data ingred
item][/loop]</SELECT>

			<input type=hidden name=mv_search_page value="recipes/reclist2">
			<input type=hidden name=mv_search_file value="ingred_lnk.txt">
			<input type=hidden name=mv_search_field value="ingred_id">
			<input type=hidden name=mv_orsearch value="1">
			<INPUT TYPE=submit VALUE=Search></form>


the values returned are passed to and displayed in reclist2:

[loop search="fi=ingred_lnk/se=[item-data ingred
code]/sf=ingred_id/ml=9999"]
<a href="[area href=scan
		arg=|
		se=[item-data ingred_lnk recipe_id]
		fi=recipes
		sf=code
		sp=recipes/recresults
		|]">[data base="recipes" field="title" key="[item-data ingred_lnk
recipe_id]"]</a></B></loop>

As it stands, this code does display a list of the correct titles in the
recipes database. Depending on how many multiple selections are searched on,
some recipes may be listed more than once, and they are un-sorted, (and for
some odd reason, only the first 50 are displayed, even while using
ml=9999!?) I wish to display unique "titles" which are sorted. I do not see
how I can sort in the loop search (using un=yes), because the database being
searched (ingred_lnk) does not contain the field "title". "title" is located
in the recipes database. I do not wish to add a field in ingred_lnk called
"title", because it is redundant information, but that seems to be one
option. This database will be large - 5000+ 'recipes', and for each recipe,
'ingred_lnk' will contain on average 4-5 'ingredient records' (with only
several fields of minimal information). All ideas and suggestions pertaining
to this 'display and sort' problem, including changes to database structure,
are greatly appreciated. Thank you.

Curt Hauge

-
To unsubscribe from the list, DO NOT REPLY to this message.  Instead, send
email with 'UNSUBSCRIBE minivend-users' in the body to Majordomo@minivend.com.
Archive of past messages: http://www.minivend.com/minivend/minivend-list


Search for: Match: Format: Sort by: