Help: Variable name used to replace table name

Hello,
please can someone explain me how to use a variable name in order to replace a table name in a grid application ?

I am referring to the fields highlighted in red in the attached picture.

At present I am getting a parsing error if I use a variable name to replace a table name:

Parse error: syntax error, unexpected ‘$_SESSION’ (T_VARIABLE), expecting identifier (T_STRING) in /opt/NetMake/v8/wwwroot/scriptcase/app/ControlliFInali/grid_MAXI_AGENTI/index.php on line 540

I am using SC V8. When I was using V7 I did not have the same issue.

What am I doing wrong ?

Thanks a lot.

grid.png

I never used that but what might be the case is that you need [] around the variable and use it as a global?

Hy Albert, today SC support confirmed me it’s a bug. Hope they will fix it soon.
I really need to use [variable] in the FROM clause of the SQL statement for a grid.

I have a lot of views generated by functions of one or more argumentS, and I need to pass such arguments as [variable]

Something like:

SELECT
T.FIELD1,
T.FIELD2
FROM
MYTABLE( MYFUNCTION([VAR1] , [VAR2] ) AS T

Hi Massimiliano,

I used this function few days ago and I had some problem, now it works, using your sample in the picture you attached, you have to setup things like that

SQL -> SELECT CODICEAGENTE, RAGIONESOCIALE FROM AGENTI

then variable name MYTABNAME (without the brackets) and what to substitute AGENTI

so you fill [MYTABNAME] with the tablename and code will subistitute (I think string replace) the word AGENTI with what the value of the variable.
For what I saw, the string replace is made before the scriptinit event, so you have to pass it as parameter and you cannot compose it in the same app.