Page 1 of 1
Table: Resize all variables in ReDim (New, New,10,New) like.
Posted: Tue Mar 31, 2009 9:41 pm
by GeBonet
Table: Resize all variables such as ReDim (New, New, New) and not only ReDim (10, New) the last ...
Like, in Old QB, and PowerBasic, and many other languages.
Its necessary when you work and use with various file open simultaneously in conjunction with the tables... And you work with 3, 4 or 5 dimension...
I have many SGBD created from me, with possibility to work with ISAM file but its necessary have, a possibility ReDim with various parametter...
Tanks for attention ! (Sorry for the English, I am French Belgian).
Posted: Sun Apr 19, 2009 4:27 pm
by GeBonet
Wy Using ReDim with all Items... ? Exemple :
If i have one or more table like : TableFile$(NumberLine, NumberCol)
Table where the columns would be = (Idend., Name, adress, zipcode, city,..., etc...)
In such a table, If I do not know in advance the number of lines, I need return the table Like this : TableFile$ (NumberCol, NumberLine).
1- It is not very compatible with the presentation of conventional tables.
2- Now If in addition I should manage these tables with Files
3- But I would also like more FILES in connection with these tables....
My Table will be see like this : TableFile$(NumberOfFile, NumberLine_Of_EatchFile, NumberCol_Of_EatchFile)
But if you do not know in advance the number of file to open, the number of articles that contain all the files, then it must be possible to dynamically resize the tables ...
This demonstrates the usefulness of power resize any table parameter
Posted: Sun Apr 19, 2009 5:15 pm
by Kaeru Gaman
you can use Dim on an existing array with arbitrary size in all dimensions,
even with other dimensions, but the content will be erased.
ReDim is for keeping existing content, and so only the outermost Dimension can be changed because there is no complicated element copying involved.
implementing a ReDim with arbitrary dimension change would mean to implement most complicated moving of single elements.
about your example: TableFile$(NumberOfFile, NumberLine_Of_EatchFile, NumberCol_Of_EatchFile)
imho it is just the way how-not-to-be-done.
putting several files into one single array of strings, sounds like an idea of Edgar Allen Poe... most creepy.
Posted: Sun Apr 19, 2009 6:50 pm
by GeBonet
Thank you very much,
I know the ReDim function for a very long time ...
And that is precisely what I would do it but in other dimensions,
and not just the latest ...
And this is an example of Table I shows as it should be resized ...
Thing, which was easily in the versions of Qb to QBX ... But long ago and in other languages ...
They served me a gerer tables dynamically configurable multiple dimensions.
Thank you anyway!

Posted: Sun Apr 19, 2009 8:05 pm
by Demivec
GeBonet wrote:Wy Using ReDim with all Items... ? Exemple :
If i have one or more table like : TableFile$(NumberLine, NumberCol)
Table where the columns would be = (Idend., Name, adress, zipcode, city,..., etc...)
In such a table, If I do not know in advance the number of lines, I need return the table Like this : TableFile$ (NumberCol, NumberLine).
1- It is not very compatible with the presentation of conventional tables.
2- Now If in addition I should manage these tables with Files
3- But I would also like more FILES in connection with these tables....
My Table will be see like this : TableFile$(NumberOfFile, NumberLine_Of_EatchFile, NumberCol_Of_EatchFile)
But if you do not know in advance the number of file to open, the number of articles that contain all the files, then it must be possible to dynamically resize the tables ...
This demonstrates the usefulness of power resize any table parameter
Would something like this work for you?
Code: Select all
Structure element
Idend.s
name.s
Address.s
zipcode.s
city.s
EndStructure
NumberLine = 300
Dim TableFile.element(NumberLine)
;change size
NumberLine = 500
Redim TableFile(NumberLine)
It doesn't handle different file numbers though. I think that would be possible with just a little more effort.
I second Kaeru's comment that you may be trying to force something into a multi-dimensional array that shouldn't be there in the first place.
If all the elements of your table are the same (i.e. strings) then you can copy them all to a single dimension array, recreate the multi-dimensional array with the new dimensions, then copy the elements back in. That is what the suggested feature request would be doing anyway.
I'll post an example if this would be useful.
Posted: Sun Apr 19, 2009 10:55 pm
by GeBonet
Thank you for your help,
I understand your explanation its very is clear.
My intent was simply to suggest an expansion in opportunities for ReDim ...
Because I think that would give a little more freedom and that's it!
Again thank you.

Posted: Mon Apr 20, 2009 12:02 am
by Demivec
Your welcome.
I agree the feature requested would expand freedom, although it would be at the expense of speed (according to Fred).
It is fortunately something that can usually be accomplished via other means.
Posted: Mon Apr 20, 2009 12:22 am
by pdwyer
Kaeru Gaman wrote:you can use Dim on an existing array with arbitrary size in all dimensions,
even with other dimensions, but the content will be erased.

I didn't know this, thanks for the tip.
Infact I was looking for a workaround to this just last night and thinking of changing data structure so that I didn't have a 2d array in there.
Cheers
