0

In AppMaker, one my datasources has a simple query script associated with, because I need a filter everytime the datasource is requested. I'm talking about a normal SQL based datasource (not calculated).

Is it normal than this query script is not used when the datasource is used in a Suggest box ? Because it breaks my app (the user is able via the suggest box to select items he's not even supposed to see).

Thanks for your help

Valentin Coudert
  • 1,759
  • 3
  • 19
  • 44

1 Answers1

0

The options for a suggest field text box can either be provided explicitly, by binding to the options property, or by specifying a database query on a model using a startsWith filter on a field. You can set the model and field for the latter option below.

So you can try to create calculated model with server script starts with

var name = query.filters.name.startsWith;

name is field of model

Andrey Koltsov
  • 1,956
  • 6
  • 24
  • 43
  • 1
    I'm using the "Suggest Box Query Options" to set up my box (because there is paging on this datasource). And if I use a calculated model, that will break the relation between this datasource and the main one (basically the suggest box is used to link an object of type B to an object of type A, being created) – Valentin Coudert Jun 07 '17 at 13:12
  • "Suggest Box Query Options" works on model directly, it doesn't touch any datasources. Options is list of stringd (List), but it depends on datasource. Hack: on "onValueChange" event, find "id" by string and set relation. I don't like this idea, but it may works to you. – Andrey Koltsov Jun 07 '17 at 15:44