forum.vdsworld.com Forum Index forum.vdsworld.com
Visit VDSWORLD.com
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


Help with LISTS

 
Post new topic   Reply to topic    forum.vdsworld.com Forum Index -> General Help
View previous topic :: View next topic  
Author Message
marcelo
Contributor
Contributor


Joined: 10 May 2008
Posts: 155

PostPosted: Sat May 10, 2008 4:40 am    Post subject: Help with LISTS Reply with quote

Hi, im new in this forum.
Im tryin to make a database application.
I am using .TXT files as databases of about 1mb and when use LIST PUT, DELETE, ADD, etc commands i need to refresh the list in the dialog...
How can i do this without closing and reopen the list? Because in Win XP this is to slow, not in win98...


Thanks a lot in advance and sorry for my English...
Back to top
View user's profile Send private message
webdaddy
Contributor
Contributor


Joined: 14 Nov 2004
Posts: 151
Location: Raleigh NC

PostPosted: Sat May 10, 2008 4:53 pm    Post subject: List Reply with quote

You could copy the contents to another list clear the original list and then copy the contents back to the original list. This would eliminate the file reads and basically keep the information in memory. Should be a little faster. Depends on available RAM however.

Webdaddy

_________________
K Wetzel
Programming - Technology - Communications
"The Home of the SLC Security Console"
SLC now available for Linux...
Back to top
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger MSN Messenger
marcelo
Contributor
Contributor


Joined: 10 May 2008
Posts: 155

PostPosted: Sat May 10, 2008 7:59 pm    Post subject: Reply with quote

Thanks!!! This is what im doing... i think...
I will post an example of my program, maybe somebody find the better way to do this...
Another question. Is there a good way to use Dbase files or Excell files? Is this better than text files lists?

thanks again...

Marcelo.
Back to top
View user's profile Send private message
marcelo
Contributor
Contributor


Joined: 10 May 2008
Posts: 155

PostPosted: Sat May 10, 2008 9:49 pm    Post subject: Reply with quote

This is an example of the program im trying to do...
I use 2 TXT files because i need to peform a search only in "descripcion" and "c_barra" (list1)
Is there a faster, smarter way to do this? I tryed using table with @tab() separators to use only 1 list, but its too slow...

Thanks again...

Marcelo



Ejemplo.zip
 Description:

Download
 Filename:  Ejemplo.zip
 Filesize:  2.79 KB
 Downloaded:  2392 Time(s)

Back to top
View user's profile Send private message
JerryDee
Contributor
Contributor


Joined: 19 Oct 2005
Posts: 53
Location: Czech Republic

PostPosted: Sun May 11, 2008 7:43 pm    Post subject: Reply with quote

Hi Marcelo,

You could try to use other way of reading variables in Timer branch

Code:
parse "%%Desc;%%codigo;%%Prov;%%Stock;etc.;etc.;;",@item(2)

where in single raws of text file (here artic.txt) are strings of values for these variables in this format: 1|2|350|4500|17| etc.| etc.

Parse command is very fast and powerfull

_________________
Jerry
(VDS 4,5,6 Pro | V-Setup 3)
Back to top
View user's profile Send private message Send e-mail
marcelo
Contributor
Contributor


Joined: 10 May 2008
Posts: 155

PostPosted: Sun May 11, 2008 8:41 pm    Post subject: Reply with quote

Thanks a lot!! I will try this...
I´m trying to solve the sort and speed problem too...

thanks...

Marcelo
Back to top
View user's profile Send private message
uvedese
Contributor
Contributor


Joined: 21 Jan 2006
Posts: 169
Location: Spain

PostPosted: Mon May 12, 2008 3:34 pm    Post subject: Reply with quote

Hola marcelo:
bien por tu trabajo, he bajado el "ejemplo.zip" y trabaja bien... si me permites la sugerencia deberías presentar los campos de datos en elementos INPUT de sólo lectura para que no pisen las etiquetas de los otros campos... es una sugerencia que aclararía la lectura y además permitiría copiar los datos presentados.

En cuanto a la búsqueda dentro del archivo de texto... Rolling Eyes se me ocurren varias ideas... una de ellas podría ser marcar el comienzo y el final del campo de descripción con un carácter diferente al separador por defecto (|), por ejemplo, #, y realizar una búsqueda con el comando MATCH, que es muy rápido. Cuando haya una coincidencia detectar si ese dato está dentro del campo marcado con #.

Prueba... y buena suerte.
________________________________

Hello Marcelo:
good job, I download "ejemplo.zip" file and works fine... I have a suggestion: you must show datas in INPUT elements read only so as not hide labels on other fields ... is a suggestion that would clarify the reading and also would copy the data presented.

About searching data in TXT file ... Rolling Eyes I have several suggestions... one: you can mark the beginning and end of the description field with a different character to default fieldseparator (|), for example, #, and do a search with the MATCH command, which is very fast. When you have a coincidence detect you can check if data is in this field (marked with #).

Try it... and good luck.

________________
uVeDeSe site:

http://www.uvedese.es
Back to top
View user's profile Send private message Visit poster's website
marcelo
Contributor
Contributor


Joined: 10 May 2008
Posts: 155

PostPosted: Mon May 12, 2008 3:47 pm    Post subject: Reply with quote

Gracias Uvedese, por las sugerencias y por el español!!! me cuesta mucho explicarme en ingles!!!. Lo de los campos imput era la forma en que lo tenia presentado anteriormente. Y con respecto a lo de la busqueda, sinceramente no entiendo bien a que te referis.
Basicamente las busquedas necesito hacerlas solamente en los campos "descripcion" y "codigo de barra" (que es lista mas pequeña). La otra lista se usa solo para obtener los datos correspondientes a ese item. Con tu propuesta podria utilizar una sola lista y buscar solo en los campos "descrip" y "c_barra"? y presentar en las lista solo la descripcion?

Muchisimas gracias.

No si esto corresponda, de lo contrario intentare traducir el mensaje...

Marcelo
Back to top
View user's profile Send private message
uvedese
Contributor
Contributor


Joined: 21 Jan 2006
Posts: 169
Location: Spain

PostPosted: Mon May 12, 2008 4:01 pm    Post subject: Reply with quote

marcelo:
yo también agradezco lo del español... de inglés estoy algo flojo.

En concreto no sé cuántos campos tienes en la lista pequeña (donde se encuentran DESCRIPCIÓN Y C_BARRA). Supongamos esto:

campo1|campo2|Descripción|campo4|c_barra

usando MATCH puedes hacer una búsqueda en todo el archivo para encontrar un término.
Si encuentras una coincidencia debes comprobar que se encuentra en el/los campo/s previstos.
Para ello tienes varias opciones... la más sencilla es leer el dato completo y utilizar el comando PARSE.

Algo así:

Code:

  list seek,lista,0
  if @match(lista,datobuscado)
    parse "%%c1;%%c2;%%descrip;%%c4;%%c_barra",@item(lista)
    if @greater(@pos(datobuscado,%%descrip),0)
      #está dentro de DESCRIPCIÓN
      info El dato está en el campo DESCRIPCIÓN
    elsif @greater(@pos(datobuscado,%%c_barra),0)
      #está dentro de C_BARRA
      info El dato está en el campo C_BARRA
    else
      warn Lo siento no encontrado
    end
  end



Espero que te sirva
Back to top
View user's profile Send private message Visit poster's website
marcelo
Contributor
Contributor


Joined: 10 May 2008
Posts: 155

PostPosted: Tue May 13, 2008 12:44 am    Post subject: Reply with quote

BUENISIMO!!!!
Muchisimas gracias, esa rutina me simplifica muchisimo trabajo!!! y podria evitarme el uso de dos listas con lo cual la velocidad aumentaria...
Te hago una ultima consulta y ya no te molesto...
Se te ocurre como hacer un "browse" en elemento List de solamente el campo "descripcion"?
NO se si se entiende, yo hasta ahora mostraba una lista con el campo descripcion y los datos de cada item los obtenia de un segundo archivo...
Podre tener un archivo con datos "Descripción|campo1|campo2|campo4|c_barra" y hacer el browse a la izquierda con el campo Descripcion? a la derecha podria seguir informando los datos como lo hago hasta ahora de la manera que vos me decis...

muchisimas gracias otra vez!!

Marcelo
Back to top
View user's profile Send private message
uvedese
Contributor
Contributor


Joined: 21 Jan 2006
Posts: 169
Location: Spain

PostPosted: Tue May 13, 2008 2:17 pm    Post subject: Reply with quote

No hay de qué...

... lo que no sé si lo que quieres es:

1º) Tener un listado de todos los campos "Descripción" de tu base de datos o...
2º) Presentar el campo "Descripción" en una lista a la izquierda (supongo que eso sería porque fuera multilínea, es decir, la descripción ocupa varias líneas).

Si es lo 1º) supongo que haciendo clic a cualquier descripción se presentarían los campos del registro seleccionado... y por ello tendrias que cargar inicialmente toda la base y conformar la lista de "Descripción". Una vez creado el cuadro de diálogo:
Code:

  list create,1
  list loadfile,1,mibasedatos.txt
  list seek,1,0
  repeat
    %a = @next(1)
    if %a
      parse "%%Descripcion;%%campo1;%%campo2;%%campo4;%%c_barra",%a
      list add,browser_descrip,%%Descripcion
    end
  until @null(%a)
  list seek,browser_descrip,0
  # la lista browser_descrip debe tener atributo CLICK
  while @event()
  wend
:evloop
  wait event
  %e = @event()
  goto %e

:browser_descripCLICK
  %%indice = @index(browser_descrip)
  if @greater(%%indice,-1)
    #aquí leemos el registro y lo presentamos
    parse "%%Descripcion;%%campo1;%%campo2;%%campo4;%%c_barra",@item(1,%%indice)

    # asignariamos las variables a los campos de datos en el cuadro de diálogo
  end
  goto evloop


En el 2º) caso basta con asignar el valor de la variable %%Descripcion a la lista browser_descrip de esta forma:

Code:
  list clear,browser_descrip
  list append,browser_descrip,%%Descripcion


Espero te sea de ayuda
____________________
uVeDeSe site:
http://www.uvedese.es
Back to top
View user's profile Send private message Visit poster's website
JerryDee
Contributor
Contributor


Joined: 19 Oct 2005
Posts: 53
Location: Czech Republic

PostPosted: Tue May 13, 2008 6:12 pm    Post subject: Reply with quote

Question Rolling Eyes

Tired

Idea

Arrow Sleep

_________________
Jerry
(VDS 4,5,6 Pro | V-Setup 3)
Back to top
View user's profile Send private message Send e-mail
uvedese
Contributor
Contributor


Joined: 21 Jan 2006
Posts: 169
Location: Spain

PostPosted: Tue May 13, 2008 6:36 pm    Post subject: Reply with quote

Apologize for using the Spanish... but my English is not good Crying or Very sad
Back to top
View user's profile Send private message Visit poster's website
PGWARE
Web Host


Joined: 29 Dec 2001
Posts: 1566

PostPosted: Tue May 13, 2008 8:26 pm    Post subject: Reply with quote

no need to apologize Smile But if possible please put a caption in English to explain what the code does, so it can be helpful to someone else in the future that may need help with the same topic.

Btw your English is perfectly fine Smile
Back to top
View user's profile Send private message
marcelo
Contributor
Contributor


Joined: 10 May 2008
Posts: 155

PostPosted: Tue May 13, 2008 11:18 pm    Post subject: Reply with quote

Sorry guys, it was my fault.
My english is not good and i wrote only in spanish.
I will test the Uvedese scripts and I wil try to put my next message in english...

thanks and sorry

Marcelo.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    forum.vdsworld.com Forum Index -> General Help All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum

Twitter@vdsworld       RSS

Powered by phpBB © 2001, 2005 phpBB Group