Error Report Viewer, using nested Query

I have 3 tables

I'am using nersted Query.

SELECT turbine.id_turbine AS ID_TURBINE,
  turbine.localisation,
  turbine.etat,
  turbine.marque,
  turbine.vitesse
FROM turbine
SELECT control.date_control,
  equipe_technique.code_acces,
  equipe_technique.role,
  equipe_technique.priorite,
  control.date_next_control,
  control.details_control
FROM control,
  equipe_technique
WHERE equipe_technique.id_responsable = control.id_responsable AND
  control.date_control BETWEEN ? AND ? AND control.id_turbine = ?

Sometimes it work

Sometimes, when I change start and end date, it is causing probleme.

image
image

error:


sometimes I lose the gateway connection.

image

I don't know if is nersted query that is not working good or my SQL query is not good .

That often means your query (and following report generation) is taking more than 60 seconds. Or having a pathological load on the gateway. Monitor your gateway's Performance page while trying to run longer timespans.

Test your query by itself in the designer's DB tool.

1 Like

You may want to look at

Use joins between your equipe_technique and control tables rather than comparison in the where statement if possible. Also, ensure you have a proper foreign key between those two tables and that your tables are properly indexed.

1 Like

I test but it not take many secondes

.
What it mean ?

Thing is, that's just the 2nd part of your nested query. It will be repeated for every record in your turbine table.
I seem to remember Phil providing a way to build the data structure required by table groups in a script. Maybe you could get better results running only one query and then building the structure with Phil's method ?
Though make sure it's actually a timeout problem before jumping down that hole.

1 Like

En vrai, je n'ai pas trop compris ce que Philp demande pour que je teste.
D'apres le doc, nersted query est plus effciace pour creer les rapport avec des tableau de données liée.

Si je crée une seule requette, comment je vais creer le tableau ci dessus dans le rapport ?
image

ce que j'attend sur mon rapport est le meme que l'exemple donnée sur le doc: Table Groups - Ignition User Manual 7.9 - Ignition Documentation

avec ca:

et un itertools.groupby.

Mais te lances pas là dedans tout de suite, attends un peu d'avoir d'autres avis.

1 Like

merci Pascal, Oui, vais attendre d'autres les avis :grinning: