Agregar Items a ListBox - Forum

Forum Navigation
You need to log in to create posts and topics.

Agregar Items a ListBox

Recibo una consulta de una base de datos Mysql y quiero cargar los datos recibidos a un Listbox

Viendo un jemplo de Luis lo que hize fue crear un Listbox cuya propiedad "Items" coincide con el nombre del array Creado

y despues intento cargar los datos recibidos en el array, pero solo se muestra uno de los datos de los 20 registros que recibo

La subrutina que recibe los datos es la siguiente:

CreateEmptyArray [tableData]
SetVar [tableData] [data]
ArrayLen [tableData] [totalRecords]

SetVar [CantidadReservas] [totalRecords]

CreateEmptyArray [Lista]       ....... coincide con la propiedad "Items" del Listbox

Loop 0 [totalRecords] [x]
DeleteVar "[Nombre]"
SetCompVar "[Nombre]" "[tableData([x])('Nombre')]"
ArrayAddItem "[Lista]" "[Nombre]"
If [x] == 0
exitloop
endif
endloop

GotoPage "ConsultasVer"

Hola @gustavo1973

Estas lineas que has añadido harán que el loop se ejecute una sola vez y por eso solo aparece el primer item:

If [x] == 0
 exitloop
endif

Yo diría que basta con que las elimines.
Saludos.

Gracias Luis por tu respuesta, sabes que si saco esas lineas el programa queda trancado ahi, nunca ejecuta la linea siguiente :

GotoPage "ConsultasVer"

 

Tu no me habias dicho creo en otro POST que los loops tienen un comportamiento distinto en VISUALNEO WEB a como lo tienen en VISUAL NEO WIN, que corren al reves, desde el valor mas alto al menor?

 

@gustavo1973

if I take those lines, the program gets stuck there, it never executes the following line:

GotoPage "QueriesView"

This line ...

ArrayLen [tableData] [totalRecords]

... will give you the actual number of records e.g. 7 ... but the array items are referenced 0, 1, 2, , 4, 5, 6 ... so when your loop command is ...

Loop 0 [totalRecords] [x]

... it will try an execute the loop 8 times ... 0 to 7 ... since the eighth array item does not exist, this may be the reason your app gets stuck (probably crashes out with an error).

Subtract one from the [totalRecords] and use that as the "stop value" in the Loop command.

Muchas gracias @gaev, ahora si funciono, pero surgio otro problema,

al ingresar a la pagina donde debe mostrar los datos en el listbox, se muestran los mismos

pero la pantalla queda cubierta con una transparencia negra en su totalidad que no permite realizar ninguna tarea.

 

Thank you very much @gaev, now it worked, but another problem arose, 
when you enter the page where you should show the data in the listbox, 
they are shown but the screen is covered with a black transparency 
in its entirety that does not allow you to perform any task.

@gustavo1973

when you enter the page where you should show the data in the listbox ,
they are shown but the screen is left with a black transparency

that does not allow you to perform any task .

That problem is not caused by any of the code discussed here.

It looks like that page has an object (e.g. Container) that stretches across the page width/height ... and is designed to display on top of all the other objects on that page ... perhaps a mechanism to prevent access to the underlying objects until a certain condition is met ... take a look ...

  • in the PageExit event code for the current page
  • or the PageEnter event code for QueriesView
  • the code where the SQL Query is requested/initiated (perhaps access to the page is blocked until query result is received)

... for a hint ... otherwise look for objects on QueriesView with such color/transparency.

Report your findings here.

Ingresa al siguiente link @gaev:
guaviyu.org/Reservas

Pass: 123

Presionar el boton "Consultas"

Seleccionar "Consultas mes determinado"

Seleccionar "2019"

Seleccionar "Octubre"

 

Enter the following link:
guaviyu.org/Bookings

Pass: 123

Press the "Queries" button

Select "Queries specific month"

Select "2019"

Select "October"

Enter the following link:
guaviyu.org/Bookings

Pass: 123

Press the "Consultas" button

Select "Consultas Mes determinado"

Select "2019"

Select "Octubre"

Ahi podras ver el problema

@gustavo1973

Looks like what I said in my earlier post.

If you are having difficulty determining where this code is, please upload your source file (i.e. Reservas.neoapp) ... if you do not want to show this to all members, send the file to @luishp and he can send it to me at my email address.