PC SOFT

FORUMS PROFESSIONNELS
WINDEVWEBDEV et WINDEV Mobile

Accueil → WEBDEV 21 → Show in static controls the results of a query.
Show in static controls the results of a query.
Débuté par Ezequiel Reverditto, 18 avr. 2017 18:52 - 4 réponses
//hostimage.webdev.info/avatars/default.gif
Posté le 18 avril 2017 - 18:52
Hello again developers!

I want to query if it is possible in a STC (Static Control) label to dump the result of the select of a query. I have done it but by putting it in a table control and a combobox but I have been trying to do it without success on this element.

I give them my code so they have an idea of ​​what I'm trying to do.

- * - Here my simple query (QRY_LBL_datosAccion)

SELECT
D005_acciones.Id_Accion AS Id_Accion,
D005_acciones.Id_Persona AS Id_Persona,
D005_acciones.Id_Estado AS Id_Estado,
D005_acciones.Description AS Description,
D005_acciones.Fecha_Limite AS Fecha_Limite,
D005_acciones.Presupuesto AS Presupuesto
DESDE
D005_acciones
WHERE
D005_acciones.Id_Accion = {nAccion}

Where nAccion is a parameter.

- * - In my page cargarEvidencia.php:

Global Declaration:
gnIdAccion is int = PageParameter ("IDACCION")

Initialization of upload.php:
nAction is int
nAccion = gnIdAccion


HExecuteQuery (QRY_LBL_datosAction, hQueryDefault, nAccion)

FileToPage (cargarEvidencia, accionesXplan)


It should be noted that each of the STCs are linked to the fields of the query (QRY_LBL_datosAccion).

Once the code is executed, the only result I get is 0 (zeroes) in each of the page tags.


I hope you can help me.
Greetings and thanks!
//hostimage.webdev.info/avatars/default.gif
Posté le 18 avril 2017 - 23:10
Hi Ezequiel,

You are missing a hreadfirst of your query before doing to the
filetopage -AND- the filetopage should be said to work on the QUERY, not
on the file

Best regards

--
Fabrice Harari
International WinDev, WebDev and WinDev mobile Consulting

Ready for you: WXShowroom.com, WXReplication (open source) and now WXEDM
(open source)

More information on http://www.fabriceharari.com


Le 4/18/2017 à 10:52 AM, Ezequiel Reverditto a écrit :
Hello again developers!

I want to query if it is possible in a STC (Static Control) label to
dump the result of the select of a query. I have done it but by putting
it in a table control and a combobox but I have been trying to do it
without success on this element.

I give them my code so they have an idea of ​​what I'm trying to do.

- * - Here my simple query (QRY_LBL_datosAccion)

SELECT
D005_acciones.Id_Accion AS Id_Accion,
D005_acciones.Id_Persona AS Id_Persona,
D005_acciones.Id_Estado AS Id_Estado,
D005_acciones.Description AS Description,
D005_acciones.Fecha_Limite AS Fecha_Limite,
D005_acciones.Presupuesto AS Presupuesto
DESDE
D005_acciones
WHERE
D005_acciones.Id_Accion = {nAccion}

Where nAccion is a parameter.

- * - In my page cargarEvidencia.php:

Global Declaration:
gnIdAccion is int = PageParameter ("IDACCION")

Initialization of upload.php:
nAction is int
nAccion = gnIdAccion


HExecuteQuery (QRY_LBL_datosAction, hQueryDefault, nAccion)

FileToPage (cargarEvidencia, accionesXplan)


It should be noted that each of the STCs are linked to the fields of the
query (QRY_LBL_datosAccion).

Once the code is executed, the only result I get is 0 (zeroes) in each
of the page tags.


I hope you can help me.
Greetings and thanks!
//hostimage.webdev.info/avatars/default.gif
Posté le 19 avril 2017 - 02:17
After Hexecuteqry you need to use Hreadfirst(YourQuery) so you actually have the data of the query in memory, then you can assign the values of the qry to the static controls like:

Mystatic1 = yourquery.field1
Mystatic2 = yourquery.field2
Mystatic3 = yourquery.field3
//hostimage.webdev.info/avatars/default.gif
Posté le 20 avril 2017 - 14:59
Hi Fabrice and Diego.

Thanks again for the guidance. I added the HReadFirst () function, assigned them to each of the STCs as they recommended me and was able to bring the fields I need to display when the BrowserOpen () function once I called.

Now, I have another small inconvenience. When I close the browser, cargarEvidencia.php (which behaves like a popup) and select another record from my table in accionesXplan.php, it returns me to the same record that I selected earlier. Osea, pass the parameter well but I still show only that record and it is maintained. And the strange thing about this is that even closing the application and starting it again still appears the same record.

It is as if the values of that first selected record are stored in memory. There is some method to "release" them.

Try to implement for the search of a particular record the HSeekFirst () function but this does not change at all, it still has the same behavior.

I show you the updated code:

In the page accionesXplan.php (Click of button cargarEvidencia -PHP Server)
IF TableSelect (TABLE_QRY_TBL_MostrarAcciones) =-1 THEN
Error("Por favor, seleccione un registro")
RETURN
END

HReadSeekFirst(d005_acciones,Id_Accion,TABLE_QRY_TBL_MostrarAcciones.COL_Id_Accion)
IF HFound(d005_acciones) THEN
lnAccion is int = TABLE_QRY_TBL_MostrarAcciones.COL_Id_Accion
gsComLine ="IDACCION="+(lnAccion)
END


Now, the page cargarEvidencia.php it looks something like this:

Global declaration of cargarEvidencia (PHP Server)
gnIdAccion is int = PageParameter("IDACCION")



Initialization of cargarEvidencia(PHP Server)
nAccion is int
nAccion = gnIdAccion


HExecuteQuery(QRY_LBL_datosAccion,hQueryDefault,nAccion)
HReadFirst(QRY_LBL_datosAccion,gnIdAccion)

FileToPage(cargarEvidencia,QRY_LBL_datosAccion)

STC_NoName1=QRY_LBL_datosAccion.Id_Accion
STC_NoName2=QRY_LBL_datosAccion.Descripcion
STC_NoName3=QRY_LBL_datosAccion.Id_Persona

STC_DATE3=DateToString(QRY_LBL_datosAccion.Fecha_Limite,"DD/MM/YYYY")

STC_NoName5=QRY_LBL_datosAccion.Id_Estado
STC_NoName6=QRY_LBL_datosAccion.Presupuesto


It's making me sweat a little this, I'm a rookie in WEBDEV. I hope you understand me and, well, thanks for the help.

Regards!
//hostimage.webdev.info/avatars/default.gif
Posté le 24 avril 2017 - 18:33
Hi, Fabrice.

Sorry to bother you, but I wanted to ask you a question about a problem that I have been trying to solve for almost 1 week but I can not hit the target, maybe you could do it in some project to implement it in a satisfactory way.

The subject is this: I have been able to show in the STC the information of my query. But ... when I close the Browser, to select another action and so I can see your information, I still continue to show the 1st record that you select from my table.

I'll graph the situation:

This happens when running my application for the first time I will see the data of an action.

1) accionesXplan.php page.





2) Once the field is selected, press "Cargar Evidencia" and store the ID and pass it as a parameter to the other window using the BrowserOpen (). And it shows me that the ID that happens coincides with the ID of the Action about which I show the information.







3) Now, once I close the page "Cargar Evidencia", I proceed to select from the table in accionesXplan PAGE, another record about which I want to see the information, as I show below:







I do the same process, I select the action and I'm going to "Cargar Evidencia", but when I open the Browser I find that the ID I capture from the table and pass it as a parameter does not match the ID of the action I want to display...






And the behavior is maintained over and over again. It only changes when I close the application, I restart it. I select an action, it shows me its information correctly and when choosing another record the data of the 1st one that I chose is displayed on screens.

The code is similar to the one shown in an earlier post, but I just debug it a bit.

In the page accionesXplan.php (Click of button cargarEvidencia -PHP Server)
IF TableSelect (TABLE_QRY_TBL_MostrarAcciones) =-1 THEN
Error("Por favor, seleccione un registro")
RETURN
END

HReadSeekFirst(d005_acciones,Id_Accion,TABLE_QRY_TBL_MostrarAcciones.COL_Id_Accion)
IF HFound(d005_acciones) THEN
lnAccion is int = TABLE_QRY_TBL_MostrarAcciones.COL_Id_Accion
gsComLine ="IDACCION="+(lnAccion)
END



Global declaration of cargarEvidencia (PHP Server)
gnIdAccion is int = PageParameter("IDACCION")



Initialization of cargarEvidencia PAGE (PHP Server)
nAccion is int
nAccion = gnIdAccion


HExecuteQuery(QRY_LBL_datosAccion,hQueryDefault,nAccion)
HReadFirst(QRY_LBL_datosAccion,gnIdAccion)

FileToPage(cargarEvidencia,QRY_LBL_datosAccion)

STC_DATE3=DateToString(QRY_LBL_datosAccion.Fecha_Limite,"DD/MM/YYYY")



I forget to mention earlier that gsComLine is an "edit control" element, I do not know if it will affect anything.
I do not think I have to see a cookie issue here. But it is as if the first selection is stored in memory and can not be cleaned. Do you know in any way when closing the "Cargar Evidencia" page, can empty the memory to allow me to show another action?

I get stuck enough, I'm looking for the thousand ways to solve it and here I am.

Thank you for your time and I hope you can give me a hand.
Regards!