How to use tables\fields names as variables in Forms and Grids

Forms and Grids have options to use variables for tables\fields names in their SQL settings:

“Variable for Table” and “Fields Variables” (Fields is available on Grids only)

But the SC online English help on these topics doesn’t make any sense to me…

Are there any examples or better explanations on how to use these variables?

OK, by trial and error I’m now able to have a single grid app that dynamically loads data from different db tables\views.

[SIZE=16px]db[/SIZE]

I created a view named ‘dumb_table’ in the db (mariadb) so that the Grid app can be configured and generated on an existing table\fields. The idea is not to use any ‘real’ table\view in the grid app configuration, so that it will keep working even if any table\view is later deleted from the db.

The view is very simple: [INDENT]

select null AS `dumb_field1`, null AS `dumb_field2`

[/INDENT] Note: create as many fields as you need.

[SIZE=16px]grid app sql settings[/SIZE]

sql select statement: [INDENT]

SELECT dumb_field1, dumb_field2 FROM dumb_table

[/INDENT] table\fields variables: [INDENT] [ATTACH=CONFIG]n72876[/ATTACH]
[/INDENT] [SIZE=16px]usage[/SIZE]

To set which tables\fields are loaded by the grid, pass the following as parameters when the app is run: [INDENT][var_real_table] = ‘name_of_the_table_to_load’
[var_real_field1] = ‘name_of_1st_field’
[var_real_field2] = ‘name_of_2nd_field’[/INDENT]

sc_table_fields_variables.png

Unfortunately Refined Search ignore the variables and use the table\fields names set in the app select statement (i.e. the ‘dumb_xxxx’ names in my previous post), so it will not work.

@NetMake: can you please make Refined Search aware of tables\fields names variables?

Very well, I did not know about that option. But Now i know.
Unfornutately the SC documentation is not good.
Thanks you for your post. I liked. :slight_smile:

Yep, but as I wrote in my last post, Refined Search is not usable :(.

Also, I haven’t tested all other search functions yet (Quick, etc.), so I don’t know yet if those will work.

Has the refined search become aware of tables\fields names variables?
Thanks!


https://tranio.es/