Question about parameter Arrays and updating values (not for beginners)

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎2020-08-25
03:05 AM
- last edited on
‎2022-09-26
10:46 PM
by
Daniel Kassai
I have a bunch of arrays that I have tried by many means update values and I have failed.
I have tried to force their update in the parameter script and in the master script, and it doesn't updates at all, whether by direct editing those values to the parameter array itself, or indirectly to the temporary variable array then to a parameter array.
What should I do for those cases ??
PS: This question is not for beginners

Solved! Go to Solution.
- Labels:
-
Library (GDL)
Accepted Solutions

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎2020-08-26 12:41 AM
1. I want to thank @Kristian Bursell & @Barry Kelly for you quick reply.
2. You assumed that I didn't use a temporary array, but unfortunately before posting my question, I have already used that method, and it didn't work, although array values in the memory have been successfully modified, but didn't pass the new values to the parameter arrays.
3. The funny part, (Thank you Google), have reminded me that I've already stumbled on that same problem ... and also reminded me that I was the one how have solved it (here & here)...



The error was happening because of a line of code
n = APPLICATION_QUERY ("PARAMETER_SCRIPT", "FIRSTOCCASION_IN_PROGRESS", _isFirstRun)
That was the one that was generating all this problem and preventing value transaction to the parameter arrays, and just by eliminating that line, everything was working as it should.


- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎2020-08-25 03:22 AM
"reset_defaults_swch" is just a boolean parameter to trigger the reset.
This works for me.
I guess you could also use a FOR/NEXT loop to set all of the values if it is a larger array.
In this case I just want to reset to seven known co-ordinate positions.
if reset_defaults_swch = 1 then DIM ac_coords[7][2] ac_coords[1][1] = 0.000 ac_coords[1][2] = 0.000 ac_coords[2][1] = 0.000 ac_coords[2][2] = 1.000 ac_coords[3][1] = -1.000 ac_coords[3][2] = 1.000 ac_coords[4][1] = -1.000 ac_coords[4][2] = 0.000 ac_coords[5][1] = 0.000 ac_coords[5][2] = 0.500 ac_coords[6][1] = -0.500 ac_coords[6][2] = 1.000 ac_coords[7][1] = -1.000 ac_coords[7][2] = 0.500 parameters ac_coords = ac_coords reset_defaults_swch = 0 parameters reset_defaults_swch = reset_defaults_swch endif
Barry.
Versions 6.5 to 27
i7-10700 @ 2.9Ghz, 32GB ram, GeForce RTX 2060 (6GB), Windows 10
Lenovo Thinkpad - i7-1270P 2.20 GHz, 32GB RAM, Nvidia T550, Windows 11

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎2020-08-25 03:33 AM
assuming array parameter is a string type called "arrayName" and it is 2 dimensional ([][]).
dim _arrayName[][] for i = 1 to vardim1(arrayName) for j = 1 to vardim2(arrayName) _arrayNameThis will populate every single cell of the array with the value "Test". if this doesn't work for you then there must be another script overwriting this script. Once you get this to work then you can focusing just on a specific cell but you should keep the loop statements so that both the the temporary and parameter arrays are the same size (vardim1 and vardim2).= "Test" next j next i arrayName = _arrayName parameters arrayName = arrayName
one important thing to remember is that if your temporary and parameter arrays are kept identical then it is actually faster to use the temporary array values rather than the parameter array values in your other scripts. The reason for this is you don't have to wait for the values to pass through to the parameter hence the object will update without a refresh. This is critical if you are doing auto labels and want an instantaneous response.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎2020-08-26 12:41 AM
1. I want to thank @Kristian Bursell & @Barry Kelly for you quick reply.
2. You assumed that I didn't use a temporary array, but unfortunately before posting my question, I have already used that method, and it didn't work, although array values in the memory have been successfully modified, but didn't pass the new values to the parameter arrays.
3. The funny part, (Thank you Google), have reminded me that I've already stumbled on that same problem ... and also reminded me that I was the one how have solved it (here & here)...



The error was happening because of a line of code
n = APPLICATION_QUERY ("PARAMETER_SCRIPT", "FIRSTOCCASION_IN_PROGRESS", _isFirstRun)
That was the one that was generating all this problem and preventing value transaction to the parameter arrays, and just by eliminating that line, everything was working as it should.


- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎2020-08-26 03:05 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎2020-08-26 11:04 AM





- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎2020-08-28 08:50 PM
Guys, I think I have found a glitch in the GDL
I think that "Parameters" function or the GDL script when converted to Binary can suffer from what I call stuttering, and that is when you have a library part with multiple similar parameters names ...
Let me explain ....
When working with an object that needs a myriad of parameters (
The problem will arise when the name of these parameters have a number of starting and ending characters that are practically equal ...
example:
bVar_turnOnLights
bVar_turnOffLight
As you can see, similarly named parameters may cause the library part to not function properly ....
I don't know if it's a GDL bug or not, but I will will confirm after finishing my tests on the same object that made me start this thread
