fix: update search field ID and improve SQL query for game search in cadastro_jogos desktop XML

This commit is contained in:
Matheus
2026-09-25 09:17:38 -03:00
parent 211721edf8
commit 461a573145
+4 -2
View File
@@ -252,6 +252,7 @@
<sqlBuilderDataSource connection-key="vitruvio" language="JavaScript">
<![CDATA[
function buildSQL(_){
var txfPesquisa = engine.getField("txfPesquisaNome").getValue();
var sqlBase = "SELECT * FROM TB_MATHEUS_MEDEIROS_AVALIACOES ORDER BY CODIGO";
var id_jogo = engine.getField("dbtJogos").getValue();
if(id_jogo != null){
@@ -366,9 +367,10 @@
<VerticalLayout width="100%" height="100%" align="MIDDLE_CENTER"
spacing="true">
<HorizontalLayout width="100%" spacing="true">
<TextField expandRatio="0.8" width="100%" id="txfPesquisa"
<TextField expandRatio="0.8" width="100%" id="txfPesquisaNome"
caption="Pesquise pelo nome do jogo" type="string"
immediate="true">
<events>
<valueChange>
<script language="JavaScript">
@@ -397,7 +399,7 @@
<sqlBuilderDataSource connection-key="vitruvio" language="JavaScript">
<![CDATA[
function buildSQL(_){
var txfPesquisa = engine.getField("txfPesquisa").getValue();
var txfPesquisa = engine.getField("txfPesquisaNome").getValue();
var sqlBase = "SELECT J.CODIGO, J.TITULO, J.GENERO, J.ANO_LANCAMENTO, J.PRODUTORA, COALESCE(ROUND(AVG(A.NOTA), 2), 0) AS NOTA_MEDIA, J.DESCRICAO FROM TB_MATHEUS_MEDEIROS_JOGOS J LEFT JOIN TB_MATHEUS_MEDEIROS_AVALIACOES A ON J.CODIGO = A.ID_JOGO";