Adam Bergeron
Adam Bergeron

Reputation: 525

App Maker Relations Not A Datasource Option

So I have two databases (Database A and Database B), with a ONE to MANY relationship.

I have a page (that used to work) where I had an Accordion Widget for Database A and one for Database B on the same page.

So if I highlighted an entry in Accordion A (Database A), then I would see all the associated entries for Database B displayed in Accordion B.

When I clicked the next entry in Accordion A, Accordion B would update appropriately. I was able to achieve this by setting the Datasource for Accordion B as Database B (relation).

This doesn't seem to be an option any more.

Is there a way to achieve the same thing via a different method?

Upvotes: 1

Views: 483

Answers (2)

Devin Taylor
Devin Taylor

Reputation: 825

Here are our docs on this: https://developers.google.com/appmaker/models/datasources#relation_datasources

I think the reason you aren't seeing the Database B (relation) option anymore is we only show that if the inherited data source is Database A. As all relation data sources need a parent data source to be based on (that's how they know to which item to show relations for). So for your case, the solution is probably to set the data source of the entire page to Database A, then go to set the relation accordion's data source, now you should see Database B(relation).

Sometimes you really just want to specify the relation datasource directly rather than have it be based on the parent, in this case you can click "advanced" in the data source chooser, and choose the relation specifically. I think the path in this case is something like:

datasources.databaseA.relations.databaseB

Upvotes: 2

Vasyl Petrushko
Vasyl Petrushko

Reputation: 366

To be able to select "Database B (relation)" as datasource "Accordion B"'s parent widget datasource should be set to "Database A".

Please select "Accordion B", use breadcrumbs above the visual page editor to find parent widget, select it and verify that datasource is set to "Database A".

Upvotes: 0

Related Questions