Global Variable in the SQL Preparation in Grid Application

Could be a simple solution, but I don’t find it: I use 4 application in Tabs, and I use a global variable to link records by a common id.
The first Tab Form Application give in OUT the [v_exersisesid] and the other 3 Tabs receive as IN the [v_exersisesid].
While for the 2 Tab Form Application all works fine, for the Tab Grid Application I’ve this error:

(pdo-mysql): WHERE exercises_id = ‘1’ [HR][/HR]1064: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ‘WHERE exercises_id = ‘1’’ at line 1
ADOConnection._Execute(WHERE exercises_id = ‘1’, false) % line 1085, file: adodb.inc.php ADOConnection.Execute(WHERE exercises_id = ‘1’) % line 1561, file: index.php grid_muscles_target_ids_apl.controle() % line 2957, file: index.php

the two SQL fields in the Grid Application contain:

SQL Select Statement

SELECT
muscles_targetid,
exercises_id,
muscle_sub_groups_id
FROM
muscles_target_ids

SQL Preparation

WHERE
exercises_id = ‘[v_exercisesid]’

Do you see any error?

You should put everything in the SQL Select Statement:

SELECT
muscles_targetid,
exercises_id,
muscle_sub_groups_id
FROM
muscles_target_ids
WHERE
exercises_id = ‘[v_exercisesid]’

SQL Preparation is needed only if you need to perform a SQL ‘action’ (e.g. insert, update or more advanced stored procedures) before the select:

  • [I][B]SQL Preparation [/B]- Enter SQL commands or procedure names [U]to be executed before the main select[/U].[/I]

I never work with tabs apps so I don’t know.

You shoud first check the source of the global var: is it set as OUT and in the on navigate event of the form app?

If that’s not the problem, I think thee are some videos on the scriptcase youtube channel about tabs apps that could help you.