PC SOFT

FORUMS PROFESSIONNELS
WINDEVWEBDEV et WINDEV Mobile

Accueil → WINDEV 2024 → Memory Tables
Memory Tables
Débuté par John Marrone, 30 juin 2004 21:20 - 7 réponses
Posté le 30 juin 2004 - 21:20
I am trying to figure out memory tables. The memory table function MAdd has only 3 parameters.
1st Parameter is the name of the memory table.
2nd parameter is the key.
3rd parameter is the return value you want.
My question is. A memory table is limited to 1 piece of info? Why can't you have a memory table with a lot of fields. I only have version 7.5 demo english now. But I have read somewhere version 8 will have functions to add, delete, sort arrays. I was hoping memory tables were equal to Clarion queues. That would be great if WinDev had somethig like that. Sort of a file in memory only. If WinDev does would somebody be kind enought to let me know how. What are they called. I need to get a subset of records, usually around 10-14 and sort them on a field so I can rank them 1,2,3 and so forth. An then put these values in the table. I need to rank a value in 1 field and put that ranking in an other field in the same record. Many thanks for any help.
John Marrone
Posté le 01 juillet 2004 - 01:11
Hi John. From your description you are talking about memzones. In Smalltalk they are called dictionaries, there being a one-to-one correspondence between words and definitions, or keys and values. They definitely have their uses, but it sounds like what you want to use is a view. Have a look at the docs for this kind of object. Yours, Brian. (Unavailable during the Tour de France but around during soccer matches.)
Posté le 01 juillet 2004 - 01:45
Make a table-control on your window.
Make this table a memory-tabel.
define the columns You need.
Fill the table with TableAdd({Tablename},{value1}TAB{value2}TAB{value3}TAB{and so on})
Greetings,
Joop
Member of the dutch speaking WinDev developergroup. (WDG)

I am trying to figure out memory tables. The memory table function MAdd has only 3 parameters.
1st Parameter is the name of the memory table.
2nd parameter is the key.
3rd parameter is the return value you want.
My question is. A memory table is limited to 1 piece of info? Why can't you have a memory table with a lot of fields. I only have version 7.5 demo english now. But I have read somewhere version 8 will have functions to add, delete, sort arrays. I was hoping memory tables were equal to Clarion queues. That would be great if WinDev had somethig like that. Sort of a file in memory only. If WinDev does would somebody be kind enought to let me know how. What are they called. I need to get a subset of records, usually around 10-14 and sort them on a field so I can rank them 1,2,3 and so forth. An then put these values in the table. I need to rank a value in 1 field and put that ranking in an other field in the same record. Many thanks for any help.
John Marrone



New-Way Automation b.v.
Posté le 01 juillet 2004 - 02:06
G'day John
Although they can be used in a few ways I find the most use for memory zones is as an "on the fly" index for a file and as a source for reports. All you do is put the sort key into the first field and the hrecnum into the second field. Sort the memzone on the first field and you have a set of pointers to the file. The simplest way to set up the memzone is from a loop reading through the file.
The memory tables will do everything else that you asked about as they are a file in memory and you can set them up very quickly from a view, query or file loop read etc. You can then treat the memory file as if it is physical file. They are really coming into their own in the current version as previously they had an 8000 record limit but that is all gone now. Memory tables can be created and either used directly in a window or they can be hidden and used as a source for other things.
The following is all you need to set up a memory table
Fileview is a data source
Hcreateview(fileview,fieldlist,sortkey,conditions)
Filetomemorytable(tablename)
The View wizard suggests that you use a while loop to put the view into a table but "filetomemorytable" does it in one statement.
Regards
Al
Posté le 01 juillet 2004 - 02:48
I want to thank everybody. Views are my answer. If when you create the view and you lock the file you can save your changes back to the file.
Thanks
John Marrone


I am trying to figure out memory tables. The memory table function MAdd has only 3 parameters.
1st Parameter is the name of the memory table.
2nd parameter is the key.
3rd parameter is the return value you want.
My question is. A memory table is limited to 1 piece of info? Why can't you have a memory table with a lot of fields. I only have version 7.5 demo english now. But I have read somewhere version 8 will have functions to add, delete, sort arrays. I was hoping memory tables were equal to Clarion queues. That would be great if WinDev had somethig like that. Sort of a file in memory only. If WinDev does would somebody be kind enought to let me know how. What are they called. I need to get a subset of records, usually around 10-14 and sort them on a field so I can rank them 1,2,3 and so forth. An then put these values in the table. I need to rank a value in 1 field and put that ranking in an other field in the same record. Many thanks for any help.
John Marrone
Posté le 01 juillet 2004 - 11:44
Hi John,
arrays are in fact the thing very similiar to Clarion queues. But in WinDev 7.5 there isn't a easy way to sort and search inside an array. In my starting WinDev days I have written a Queue class (based on arrays) for myself. Since WinDev 8 I don't use this class anymore.
WinDev 8 has all the whistle and bells for arrays. You can even search for values in structures or for properties in classes.
HTH
Raimund
I was hoping memory tables were equal to Clarion queues. That would be great if WinDev had somethig like that. Sort of a file in memory only. If WinDev does would somebody be kind enought to let me know how. What are they called. I need to get a subset of records, usually around 10-14 and sort them on a field so I can rank them 1,2,3 and so forth. An then put these values in the table. I need to rank a value in 1 field and put that ranking in an other field in the same record. Many thanks for any help.
John Marrone



http://www.invitec.com
Posté le 01 juillet 2004 - 12:24
My question is. A memory table is limited to 1 piece of info? Why can't you
have a memory table with a lot of fields

You can have a lot of fields in a memory zone (if thats what you mean bij memory table) if you sepperate the fields with
MemAdd("MemZone","SortKey","Field1"+TAB+"Field2"+TAB+...+"Filedn")
When you retrieve the result, then use ExtractString() to retrieve the fields
from the result string
ExtractString(resultstring,2) to retrieve field number 2
Alex
Posté le 01 juillet 2004 - 12:55
G'day John
Re : "Views are my answer. If when you create the view and you lock the file you can save your changes back to the file.
A query would be the best for that functionality not a view.
Regards
Al