Appmaker - Relation between local datasource and e

2019-07-30 11:17发布

Trying to make a relational join between a local source (MyStaff) and the external datasource Directory (my company's directory).

However, there isn't an option to relate them.

Was hoping to create a local datasource with custom fields that I can "append" to user records from the existing Directory datasource.

Any help is appreciated.

L.

1条回答
迷人小祖宗
2楼-- · 2019-07-30 11:40

There is no way to create relations between Directory Model and other model types. You have at least three ways to workaround this shortage:

One

Query directory records on the fly - this will okish work for single-record pages, but it will be tooo slow for lists.

Two

You can duplicate Directory fields you need in your tables.

Pros:

  • it will NOT slow down your app
  • it will let you to implement queries with mixed models data (Directory + Drive Tables or Cloud SQL)

Cons:

  • You will store same data in two different places
  • Eventually your version of Directory data will become stale

You can find nice sample of the second approach in People Skills app.

Three

Query Directory data on demand. Let's say you have databound list, and records bound to the list have UserEmail field. In this case you can:

  1. Add some button to the list row
  2. In button onClick event handler add code similar to this:
app.datasources.Directory.query.filters.PrimaryEmail._equals = widget.datasource.item.UserEmail;
app.datasources.Directory.load();
app.showPage(app.pages.UserDetails); // or app.showDialog(app.pages.UserDetails);
查看更多
登录 后发表回答