[ic] Item Editor and Foreign Key Reference
maillists
lists at gmnet.net
Wed Oct 19 18:28:35 EDT 2005
On Wed, 2005-10-19 at 14:04 -0700, Christian Brink wrote:
> There appears (Database Lookup in the Meta Information Edit screen) to
> be a way to add a field to the Item Editor that reference a another
> table based on a foreign key. But I can't seem to find docs on it or
> experiment to get it to work.
>
> I have added a Manufacturers Table and a field called 'manu_id' to the
> product table that references the Manufacturers Table 'id' field. These
> modifications have been added to the Interchange table definitions.
>
> Basically:
> Table: Manufacturers
> id
> name
>
>
> I would like to have a select box on the Item Edit page that displays
> the name and contains the value for the 'id'. So this can update the
> product table.
>
> Right now I only have a text entry box which shows/updates the id. Not
> an optimal solution.
>
> I would greatly appreciate any help or a point to some docs.
>
> Christian
> _______________________________________________
> interchange-users mailing list
> interchange-users at icdevgroup.org
> http://www.icdevgroup.org/mailman/listinfo/interchange-users
Here is an example code for a page...
##look up records in the first table
[search-region
prefix=table1_select
list_prefix=table1_select_list
search="
fi=table1
st=db
sf=code
se=some-value
op=eq
"]
[on-match]
<table>
[/on-match]
[table1_select_list]
##get records in the 2nd table based on a key in the first table
[loop
prefix=table2_select
list_prefix=table2_select_list
search="
fi=table2
st=db
sf=code
se=[table1_select-data table1 table2code]
op=eq
"]
[table2_select_list]
<tr class="contentbar2">
<td valign=top class="contentbar2">
table2 title: <b>[table2_select-data table2 title]</b>
</td>
</tr>
[/table2_select_list]
[/loop]
<tr class="contentbar2">
<td valign=top class="contentbar2">
<table border="0" cellspacing="0" cellpadding="4" width="100%">
<tr class="contentbar2">
<td valign=top class="contentbar2">
table1 title: <b>[table1_select-data table1 title]</b><br>
</td>
</tr>
</table>
</td>
</tr>
[/table1_select_list]
[on-match]
</table>
[/on-match]
[no-match]
Nothing Found on table1
[/no-match]
[/search-region]
Hope that helps
Rick
More information about the interchange-users
mailing list