I guess I don't understand why you need to create the array variable with the
Run Command syntax.  Why not just create an empty array as you normally would in
your MapBasic program and then use ReDim to size the array to the necessary
number of fields:

Dim MyArray() As String

...some code...
ReDim MyArray(mysize)

-Gary.

Mapmail wrote:

> This does quite limit my possibilities when working with arrays.
> What is then the normal procedure, for reading arrays from textfiles and
> storing in MapInfo tables ?
> Do you really create a separately named variable for every data post that
> you read ?
> In my case I am reading up from 20 to 75 fields, with 10 to 24 rows,
> needless to say this would be extremely heavy to handle with separate
> variables.
> And since my table is created dynamically (this was not hard in MapInfo) I
> will also have a large problem when I want to store the variables I have
> read.
>
> I will have a look at the possibilities for creating a Visual Basic Program
> that I can send my variables to and later retrieve from for storage. Any
> Input on this idea is welcome !
>
> Thanks for the help
>
> J.I.Dali
>
> > -----Original Message-----
> > From: Gary Schwartz [SMTP:[EMAIL PROTECTED]]
> > Sent: 22. juli 1999 14:31
> > To:   Mapmail
> > Cc:   '[EMAIL PROTECTED]'
> > Subject:      Re: MI MB 'Run Command' possibilities
> >
> > From my experience, the Run Command statement works just like the MapBasic
> > Window, which means that you can't use functions or subroutines.  However,
> > you
> > can use the Dim statement, but you can't Dim arrays.  So a work around for
> > arrays would be something like this:
> >
> > For i = 1 to NumElements
> >     Run Command "Dim ArrayElement" + Str$(i)
> > Next
> > 'this gives you variables:
> > 'ArrayElement1, ArrayElement2, etc.,
> >
> > I'm fairly certain that any variables that you 'Dim' using the Run Command
> > statement end up in the MapInfo global space (as opposed to your MapBasic
> > program's global space) which means that they are visible from other mbx's
> > as
> > well as the MapBasic Window (I used this handly little feature to write an
> > mbx
> > that creates a bunch of variables with the names and values of the
> > constansts
> > defined in the MapBasic.def so I could use them from the MapBasic window).
> > However, this means that you are tying up global memory resources and once
> > the
> > variables exist, if you try to create them again (i.e., by running your
> > mbx
> > again) you will get an error.  Therefore, you should end your program by
> > using
> > the 'UnDim' statement to get rid of any variables that you 'Dim'ed.  So,
> > for the
> > above example, you would:
> >
> > For i = 1 to NumElements
> >     Run Command "UnDim ArrayElement" + Str$(i)
> > Next
> >
> >
> > Hope this helps,
> > Gary.
> >
> > Mapmail wrote:
> >
> > > Hello everyone
> > >
> > > I have a question concerning MapBasic.
> > > When using 'Run Command', is there a way to use the statements 'Call',
> > 'Dim'
> > > and 'ReDim' as the command ?
> > > e.g.
> > > Str1 = "Call "
> > > Str2 = "Myfunction"
> > > Run Command Str1+Str2
> > >
> > > or e.g.
> > > Str1 = "Dim "
> > > Str2 = "Myarray(10) as string"
> > > Run Command Str1+Str2
> > >
> > > I have not succeded, but maybe I'm doing something wrong.
> > >
> > > Thank you in advance
> > >
> > > J.I.Dali
> > >
> > > ----------------------------------------------------------------------
> > > To unsubscribe from this list, send e-mail to [EMAIL PROTECTED] and put
> > > "unsubscribe MAPINFO-L" in the message body, or contact [EMAIL PROTECTED]

----------------------------------------------------------------------
To unsubscribe from this list, send e-mail to [EMAIL PROTECTED] and put
"unsubscribe MAPINFO-L" in the message body, or contact [EMAIL PROTECTED]

Reply via email to