SyncSet involving 3 tables

Hi, in my data structure two tables are linked via a third table. So classes and their attributes are linked in the link table where each row contains a class_id and an attribute_id.
How would I build this link in a SyncSet?
You can find my approach below. It does not work and I don’t know how to encode which field of the class_attributes_link table is linked to which other field in the other tables.
Thanks for your help!

{
“id”: “syncSetSelectedClass”,
“sources”: [
“classes_ds”,
“classAttributes_ds”,
“class_attributes_link_ds”
],
“joins”: [
{
“datasource”: “classes_ds”,
“columns”: [
“class_id”
]
},
{
“datasource”: “classAttributes_ds”,
“columns”: [
“attribute_id”
]
},
{
“datasource”: “class_attributes_link_ds”,
“columns”: [
“class_id”,
“attribute_id”
]
}
],
“syncMap”: [
{
“source”: “classes_ds”,
“targets”: [
“class_attributes_link_ds”
]
},
{
“source”: “class_attributes_link_ds”,
“targets”: [
“classAttributes_ds”
]
}
]
}

Hi Anna :slight_smile:

From my experience (not certain), this is actually not possible because like you said - you have no way of specifying which column matches which other column (would be a different case if you had the class_id also available in the attributes table and vice versa).
Have you tried solving this with 2 Sync-Sets instead? In one Sync-Set you would use your attribute-table and the link-table and in the other Sync-Set you would use the class-table and the link-table.
In the app you would then apply the first SyncSet to the elements which use the attributes table and the ones which use the link table and the second SyncSet to elements which use the class table and again the ones which use the link table.

3 Likes