[ic] pedigree database

Jamie Neil interchange-users@icdevgroup.org
Fri Jun 6 14:33:00 2003


> -----Original Message-----
> From: interchange-users-admin@icdevgroup.org
> [mailto:interchange-users-admin@icdevgroup.org]On Behalf Of localhost
> Sent: 06 June 2003 18:41
> To: interchange-users@icdevgroup.org
> Subject: [ic] pedigree database
>
>
> Hi,
>
> I wanted to build a dog pedigree database, and I was wondering the best
> way to handle building the results page.
>
> so far my test site is at:
> http://www.amselravenwood.com/cgi/avr/scan/mp=shepards.html
>
> you can click ont the dog names to see the pedigree info.
>
> I am using a mysql database, and I wanted to know the best way to pull
> the data for the "grandparents"
>
> this is the code to find the "father" of a dog:
> ---------------------
> <!--Father -->
> [search-list]
> [if data dogs::sire::[item-data dogs code]]
> [query sql="SELECT registered_name FROM dogs WHERE registration_num =
> '[item-data dogs sire]'"
> type=list]
> [on_match]
>   > [list][sql-code][/list]
> [/on_match]
> [no_match]no match[/no_match]
> [/query]
> [else]data missing[/else]
> [/if]
> [/search-list]
> --------------------

I think your [list] tag needs to go outside the [on_match] tag like so:

	[on_match]Found:<br>[/on_match]
	[list]> [sql-code]<br>[/list]
	[no_match]Not Found<br>[/no_match]

The list tag is processed for each match, while the on_match tag is only
processed once.

This should produce the following if there are three matches:

	Found:
	> item1
	> item2
	> item3

and the following if there are no matches:

	Not Found

If you are sure that the query will only return one match, then you can use
the [data] tag instead:

	[data table=dogs field=registered_name key='[item-data dogs sire]'
foreign=registration_num]

Jamie

>
> Also, the "no-match" is not working. there is always a match if the
> first "if" passes.
>
> Anybody have any ideas?
>
> Thanks
> Rick
>
> _______________________________________________
> interchange-users mailing list
> interchange-users@icdevgroup.org
> http://www.icdevgroup.org/mailman/listinfo/interchange-users
>