
Quote from Palamar on November 15, 2023, 8:48 pmHola Gente como va?, tengo una pregunta para un prueba que estoy haciendo y no logro dar con una solución adecuada.
Utilizando el plugin neoPhp y el comando Wait es posible traer gran cantidad de datos para luego por ejemplo procesarlos en un Loop. Hacemos la llamada de neoPhp y la misma redirige a la subrutina correspondiente (algo que todos ya conocemos). En la subrutina tenemos algo así por ejemplo :
CreateEmptyObject [misDescargas] SetVar [misDescargas] [respDescargas] ArrayLen [misDescargas] [DL] math "[DL]-1" 0 [DL] Loop 0 [DL] [LI] ........ Lo que hagamos aquí endloopBien, el tema es el siguiente, muchas veces cuando los datos son demasiados puede haber problemas en la sincronización, me refiero a que el Loop empieza antes de que los datos se encuentren en el Array ([misDescargas]) en este caso. Para estos temas se hace uso del Wait anteponiéndolo antes del loop, y esta bien cuando los datos son fijos (y hasta cierto punto) ¿pero qué hay cuando los datos son variables?.
Así que la pregunta es, hay forma de resolver esto asincrónicamente, como decirlo, hasta que el array no este llena no salta al Loop. He intentado varias cosas pero nada funciona correctamente es por eso que me pregunte si quizás me estoy saltando algún comando que pueda utilizarse para estas cosas. Para verlo en programación:
CreateEmptyObject [misDescargas] SetVar [misDescargas] [respDescargas] ArrayLen [misDescargas] [DL] math "[DL]-1" 0 [DL] Comprueba si [DL] es mayor a 0 sino vuelve a chequear sin pasar al loop > Loop 0 [DL] [LI] ....... Lo que hagamos aquí endloopHe intentado con un While pero si éxito, quizás no estoy haciendo las cosas bien.
Desde ya gracias por cualquier idea!
Saludos!
Hola Gente como va?, tengo una pregunta para un prueba que estoy haciendo y no logro dar con una solución adecuada.
Utilizando el plugin neoPhp y el comando Wait es posible traer gran cantidad de datos para luego por ejemplo procesarlos en un Loop. Hacemos la llamada de neoPhp y la misma redirige a la subrutina correspondiente (algo que todos ya conocemos). En la subrutina tenemos algo así por ejemplo :
CreateEmptyObject [misDescargas] SetVar [misDescargas] [respDescargas] ArrayLen [misDescargas] [DL] math "[DL]-1" 0 [DL] Loop 0 [DL] [LI] ........ Lo que hagamos aquí endloop
Bien, el tema es el siguiente, muchas veces cuando los datos son demasiados puede haber problemas en la sincronización, me refiero a que el Loop empieza antes de que los datos se encuentren en el Array ([misDescargas]) en este caso. Para estos temas se hace uso del Wait anteponiéndolo antes del loop, y esta bien cuando los datos son fijos (y hasta cierto punto) ¿pero qué hay cuando los datos son variables?.
Así que la pregunta es, hay forma de resolver esto asincrónicamente, como decirlo, hasta que el array no este llena no salta al Loop. He intentado varias cosas pero nada funciona correctamente es por eso que me pregunte si quizás me estoy saltando algún comando que pueda utilizarse para estas cosas. Para verlo en programación:
CreateEmptyObject [misDescargas] SetVar [misDescargas] [respDescargas] ArrayLen [misDescargas] [DL] math "[DL]-1" 0 [DL] Comprueba si [DL] es mayor a 0 sino vuelve a chequear sin pasar al loop > Loop 0 [DL] [LI] ....... Lo que hagamos aquí endloop
He intentado con un While pero si éxito, quizás no estoy haciendo las cosas bien.
Desde ya gracias por cualquier idea!
Saludos!

Quote from Phil78 on December 12, 2023, 9:06 pm@palamar I have the same problem I have tried with wait and delay (the result seems different but not better).
For example I load a file (20 Ko) and even with delirious wait values I'm not able to enter into the loop because maxligne is undefined, but the console log just at the end show the whole array.
FileToVar "txt_avent3.txt" [texte]
wait 1000
StrParse "[texte]" "\r\n" [Lignes]
wait 5000
ArrayLen [Lignes] [maxligne]
Math "[maxligne]-1" 0 [maxligne]
StrLen "[Lignes(0)]" [Larg]
SetVar [Larg] [Larg]-1
Consolelog "Parse effectué"
endWait
endwaitwait 6000
Consolelog "maxligne [maxligne]"
Loop 0 [maxligne] [nL]
.....
EndLoop
Consoletable [Lignes]endwait
@palamar I have the same problem I have tried with wait and delay (the result seems different but not better).
For example I load a file (20 Ko) and even with delirious wait values I'm not able to enter into the loop because maxligne is undefined, but the console log just at the end show the whole array.
FileToVar "txt_avent3.txt" [texte]
wait 1000
StrParse "[texte]" "\r\n" [Lignes]
wait 5000
ArrayLen [Lignes] [maxligne]
Math "[maxligne]-1" 0 [maxligne]
StrLen "[Lignes(0)]" [Larg]
SetVar [Larg] [Larg]-1
Consolelog "Parse effectué"
endWait
endwait
wait 6000
Consolelog "maxligne [maxligne]"
Loop 0 [maxligne] [nL]
.....
EndLoop
Consoletable [Lignes]
endwait


Quote from Phil78 on December 13, 2023, 8:02 pm@luishp Thank you Luis, I hadn't thought of that. It changes the way you code but it gives a good result.
What do you think is the right strategy in the example I've given?
@luishp Thank you Luis, I hadn't thought of that. It changes the way you code but it gives a good result.
What do you think is the right strategy in the example I've given?

Quote from luishp on December 14, 2023, 6:51 pm@phil78 to tell you the truth I have never faced the same problem. Please provide a simple sample app so I can undertand whats happening. Usually reading and parsing a text file takes just a few milliseconds.
@phil78 to tell you the truth I have never faced the same problem. Please provide a simple sample app so I can undertand whats happening. Usually reading and parsing a text file takes just a few milliseconds.

Quote from Palamar on December 19, 2023, 6:56 pmGracias a ambos @phil78 y @luishp
El tema de Watch no lo he probado aunque desde ya supongo que puede ser lo que se esta buscando. Yo hasta ahora voy relativamente bien con loops y wait, pero el problema existe ya que todo es medido "a ojo" como se dice por acá, o sea, de forma un poco inexacta.
Cuando pides datos a un server o traes un archivo es cierto que la demora es de milisegundos. El problema se da cuando los datos en un Loop por ejemplo son largas cadenas a analizar o procesar o que con el resultado de las mismas y de forma automática se necesite, por ejemplo, entrar en otro Loop.
También están en este punto las demoras del server. Lo que quiero expresar es:
1)PEDIDO AL SERVER >
2) RESPUESTA<
3) PROCESO>
Muchas veces cuando se dan estos casos si el punto 2 demora pues el punto 3 comienza sin datos por lo que no procesa nada. Practicaré con Watch y veremos si es la solución.
Gracias.
Gracias a ambos @phil78 y @luishp
El tema de Watch no lo he probado aunque desde ya supongo que puede ser lo que se esta buscando. Yo hasta ahora voy relativamente bien con loops y wait, pero el problema existe ya que todo es medido "a ojo" como se dice por acá, o sea, de forma un poco inexacta.
Cuando pides datos a un server o traes un archivo es cierto que la demora es de milisegundos. El problema se da cuando los datos en un Loop por ejemplo son largas cadenas a analizar o procesar o que con el resultado de las mismas y de forma automática se necesite, por ejemplo, entrar en otro Loop.
También están en este punto las demoras del server. Lo que quiero expresar es:
1)PEDIDO AL SERVER >
2) RESPUESTA<
3) PROCESO>
Muchas veces cuando se dan estos casos si el punto 2 demora pues el punto 3 comienza sin datos por lo que no procesa nada. Practicaré con Watch y veremos si es la solución.
Gracias.

Quote from Phil78 on December 20, 2023, 8:46 pmHi @luishp You are right, I think my error comes from the fact that with Wait the whole execution block must be encapsulated in the Wait/EndWait block. In this case, latency times of 100ms are sufficient.
FileToVar "txt_avent3.txt" [texte]
Wait 100
StrParse "[texte]" "\r\n" [Lignes]
Wait 100
ArrayLen [Lignes] [maxligne]
Math "[maxligne]-1" 0 [maxligne]
StrLen "[Lignes(0)]" [Larg]
SetVar [Larg] [Larg]-1
Consolelog "maxligne [maxligne]"
Loop 0 [maxligne] [nL]
......
EndLoop
EndWait
EndwaitOn the other hand, if I use Delay, even if I increase the duration, I get an error. If I execute the operation several times, it works because of the memory cache. Attached is the example
Hi @luishp You are right, I think my error comes from the fact that with Wait the whole execution block must be encapsulated in the Wait/EndWait block. In this case, latency times of 100ms are sufficient.
FileToVar "txt_avent3.txt" [texte]
Wait 100
StrParse "[texte]" "\r\n" [Lignes]
Wait 100
ArrayLen [Lignes] [maxligne]
Math "[maxligne]-1" 0 [maxligne]
StrLen "[Lignes(0)]" [Larg]
SetVar [Larg] [Larg]-1
Consolelog "maxligne [maxligne]"
Loop 0 [maxligne] [nL]
......
EndLoop
EndWait
Endwait
On the other hand, if I use Delay, even if I increase the duration, I get an error. If I execute the operation several times, it works because of the memory cache. Attached is the example
Uploaded files: