Replies: 1 comment
-
Very clever. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Finally I figured out how to use relationship picker in internal db :)
The return value for the relationship picker is id .
So binding as usual doesn't work because it doesn't match the field value (e.g. country in text).
The solution was simple.
We just needed to create a static formula column that copied the id of the relationship field.
In that column, the id value would be stored as text.
We can then match the return value of the relationship picker when binding.
<< example >>
Let's create a feature that, when you select a country, shows you the cities in that country.
table A : country (one relation)
table B : city (many relation)
The photo above shows a working screen from the city table.
You can see the relationship column named 'Country'.
Next to it, 'ssCountry' is a static formula column that we created to copy the id value from the relationship column.
Enter the javascript code as shown in the photo above.
The number 0 between 'Country' and '_id' is the array number.
The contents of the relationship column is an array object.
Since the country column is 'One relationship' column, the number of contents is only 1. Therefore, the array number should be 0.
If you are using an internal db, you can now freely use the relationship picker on the design screen.
Enter a filtering condition in the data provider to match the selections in the relationship picker against the ssCountry column in the first picture.
And under the data provider, you can put any component you want: table, card, etc. :)
Beta Was this translation helpful? Give feedback.
All reactions