String Arrays
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2007-03-31 03:12 AM
I wanted to create an array that a user could use to input some 3 character variables.
If I dimension the variable (I.e., DIM wlunit [10][10] or even DIM wlunit [][] in the Master Script, the user cannot enter any values. In the past, I was able to initialize the array in the Master script and then the user would be allowed to change the values. Now I cannot initialize the array or dimension it.
A part created in AC9 (or was it AC8 that was then saved in AC9) with an array. It has an initialized array and I can change the parameters later in the object setting dialog box.
Is there a correct way to do it? It would be nice to be able to initialize my array.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2007-03-31 06:47 AM
This may be way off base but, have you declared
the array once in the parameter list and then
the same array again in the master script ?
David Nicholson-Cole discovered that this
worked in versions prior to AC 8.0 but
did not work from 8.0 onward.
You declare and initialize the array once
in the parameter list and the user can change the values.
Sorry if this has nothing to do with your issue.
Peter Devlin
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2007-03-31 07:28 AM
Thanks for the suggestion. I think you did help me on one thing because I thought about using a dynamic array (correct term?) with an unspecified size but then the array didn't show up in the parameter list and therefore there wasn't any way for the user to enter any information. I added the array in the parameter list and then discovered I had to eliminate the DIM statement.
If I declare the array in the parameter list, how do I initialize the array? I will try a few things.
I may post something to gdl-talk if I can find the link.
Thanks again
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2007-03-31 06:09 PM
I often use a FOR loop such as:
FOR i = 1 TO whatever
PARAMETERS array_1
NEXT i
Naturally you have to enclose this in some conditional statement (with GLOB_MODPAR_NAME or such) or it will constantly override any user input.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2007-03-31 08:06 PM
Thanks for the hint. I have never used the GLOBAL_MODPAR_NAME in the past except to tinker but I understand the concept and will try that.
Thanks.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2007-03-31 09:21 PM
The way you initialize a parameter list array is the following.
Select the variable type in the usual way (length, pen, text, etc).
Push the array icon button and the array opens but it is a one
dimensional array with one row and one column.
To get more than one row select the row number
which is initially 1 and then push the "insert" button
at the bottom of the dialog as many time as needed.
To get more columns, select the first column number and
press the "insert" button and more columns will be created.
After you have opened the array dialog for the first time
the only way you can open it again is to use the "Set" button
which comes available if you click on the parameter.
After you have set up your rows and columns you
can initialize the values you want.
Peter Devlin
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2007-03-31 09:48 PM
I had created the array as you described but perhaps I am not making myself clear. Assuming I have created a 10x10 array in the parameters list and want to initialize all of the values to "" (null) inside the GDL object.
If I use a FOR/NEXT loop to initialize the array, the user is not able to change the values in the object properties dialog box. I guess I need to use the GLOB_MODPAR_NAME in a conditional statement? I didn't have to do this in the past but...
Regards
Phil
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2007-03-31 10:07 PM
I was just playing around with the array parameter
and after the rows and columns are created all
of the values are "null" or blank by default.
As far as I can tell this does not change until
you or the user fills in the cells with characters.
I will check again.
Thanks,
Peter Devlin
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2007-03-31 10:20 PM
As I said it worked in previous versions of AC and doesn't now so I just want to know if there is a way to do it properly.
Phil
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2007-03-31 10:28 PM
I just checked again and indeed all the cells created
when I make the rows and columns I want are blank by default.
I saved the object, inserted an instance in the plan, selected it,
opened the settings dialog, and opened the array parameter
dialog and all the cells were blank.
I inserted some characters in a few of the blank cells, hit OK
and returned to the plan. I selected the object again
and opened it's setting dialog and checked to see
if the changes I made had held. They did.
I am sorry. I am clearly missing something.
Thanks,
Peter Devlin