Using value of other column in condition of foreign key

Talk about implementing of customized templates

Moderators: ne_moj, zewa, vadimako, ne_moj, zewa, vadimako

shribigb
Newbie
Newbie
Posts: 1
Joined: Dec 7th, '11, 23:42

Using value of other column in condition of foreign key

Postby shribigb » Dec 8th, '11, 17:07

Hi,

I am trying to implement following.

I have one table with following:
Table 1
id | dbid
1 | 10
32| 10
23| 11
19| 11

I have other table which has text values for id entries

Table 2
id | dbid | name
1 | 10 | abc
32 | 10 | pqr
23 | 11 | lmn
19 | 11 | xyz

I am declaring foreign key in edit mode to display text name for the id entries.. but I have to place the condition using dbid, otherwise in the dropdownlist it has all abc, pqr, lmn, xyz entries.. How will I make use of this selected dbid in foreign_key?

Thanks,

Shri

administrator
Site Admin
Site Admin
Posts: 5988
Joined: Jan 7th, '09, 23:18
Contact:

Re: Using value of other column in condition of foreign key

Postby administrator » Dec 11th, '11, 10:50

Each foreign field has following attribute:
"condition"=>"",
so you may use it to suit your needs.

For example :

Code: Select all

"condition"=>"TableName_1.FieldName > 'a' AND TableName_1.FieldName < 'c'"


Return to “Add/Edit/View Mode Templates Implementing”