Since Starting with version 1.0.5, the values for the custom fields of type the Database Child Information type can be displayed depending on the primary key of the value from the parent field (of type the Database Information type).
The convention for storing To store the primary key in a database custom field is to , mark the primary key field in the query using "as pk".
Example 1
Let's use a nested select in a dynamic query for an example:
Code Block | ||
---|---|---|
| ||
SELECT id, fk_id, col1 FROM testTable1 WHERE fk_id = (select id from testTable2 where col = {customfield_10000}); | ||
If the parent field does not have
...
a child custom field associated, there is no need to use to search by primary key.
For those fields, the query should look like:
Code Block | ||
---|---|---|
| ||
SELECT id as pk, fk_id, col1 FROM testTable1 WHERE fk_id = (select id from testTable2 where col = {customfield_10000}); |
Example 2
In the following example we assume the results of the following query will return multiple values for the parent field:.
Code Block |
---|
select country, city from table; |
Suppose For instance, we have multiple cities and one country. If we have defined define one field that would to store the countries and the child stores to store the cities , using without pkprimary key, we would have one value for the country and one value for the city.
...
Code Block | ||
---|---|---|
| ||
select country, city, id as pk from table; |
Then the parent should will have a list of countries (same name) , but with different ids and the child field can have one of the cities specified for that country.