Using returned request parameters in IF statements
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā2020-09-25
01:40 AM
- last edited on
ā2021-09-15
09:45 AM
by
Noemi Balogh
I am currently trying to develop an door and window marker to display a particular manufacturers code dependent on size, window type and transom location. I have successfully managed to return the information and display it via a text box however I cant manage to utilize the information to set my own predefined parameters.
In the below the text2 command shows the correct boolean response however I cant use it to define the "T_Widotrans_Code" text parameter
I am also trying a similar process to call the name of the window and define a code with similar levels of success
Is there something I'm missing.... its driving me Bonkers
!!!! MASTER SCRIPT !!!!
val_TSOM=0
!!!! 2D SCRIPT !!!!
t=REQUEST("ASSOCLP_PARVALUE","gs_LTrans",trans_name,type_T,flag_T,dim1,dim2,val_TSOM)
TEXT2 0,0,val_TSOM
!!!! PARAMTER SCRIPT !!!!
IF val_TSOM=0 THEN PARAMETERS T_Widotrans_Code = "" ELSE: PARAMETERS T_Widotrans_Code = "T" :ENDIF
Solved! Go to Solution.
- Labels:
-
Library (GDL)
Accepted Solutions

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā2020-09-28 12:03 PM
Using requests or any of their versions, and I quote from ArchiCAD's 23 GDL Reference Guide
Compatibility up to ARCHICAD 19: The use of most requests in parameter scripts (or master scripts run as parameter script) could result in unreliable returned values.
ie: it means, that using request in Parameter Script or in Master Script were it's part of the script is being interpreted as Parameter Script will cause trouble
Which I see that you have managed to avoid ...
1. Read the manual's GDL styling ... and start by adding spaces for god's sake, you're not saving bytes on your storage device worth considering and you're making reading the script a lot harder on everybody including yourself.
2. I would have solved this in another way ... starting in the Master Script:
delete val_TSOM = 0
The reason is that Master Script although is the first script to run, you can not detect successfully if it would run again after the the execution of Parameter Script or the UI Script, so it will be as if you have set "val_TSOM = 0" as preferential value.
3. "2D Script", I would have added the following line in blue:
t = REQUEST ("ASSOCLP_PARVALUE", "gs_LTrans", trans_name, type_T, flag_T, dim1, dim2, val_TSOM)
val_TSOM = val_TSOM
TEXT2 0,0,val_TSOM
That way, you have consolidated "val_TSOM" variable value in memory.
4. Modify the parameter script to Graphisoft's styling and leave it as it is.
Try it out and comment

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā2020-09-25 11:28 AM
Hope this helps.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā2020-09-28 12:03 PM
Using requests or any of their versions, and I quote from ArchiCAD's 23 GDL Reference Guide
Compatibility up to ARCHICAD 19: The use of most requests in parameter scripts (or master scripts run as parameter script) could result in unreliable returned values.
ie: it means, that using request in Parameter Script or in Master Script were it's part of the script is being interpreted as Parameter Script will cause trouble
Which I see that you have managed to avoid ...
1. Read the manual's GDL styling ... and start by adding spaces for god's sake, you're not saving bytes on your storage device worth considering and you're making reading the script a lot harder on everybody including yourself.
2. I would have solved this in another way ... starting in the Master Script:
delete val_TSOM = 0
The reason is that Master Script although is the first script to run, you can not detect successfully if it would run again after the the execution of Parameter Script or the UI Script, so it will be as if you have set "val_TSOM = 0" as preferential value.
3. "2D Script", I would have added the following line in blue:
t = REQUEST ("ASSOCLP_PARVALUE", "gs_LTrans", trans_name, type_T, flag_T, dim1, dim2, val_TSOM)
val_TSOM = val_TSOM
TEXT2 0,0,val_TSOM
That way, you have consolidated "val_TSOM" variable value in memory.
4. Modify the parameter script to Graphisoft's styling and leave it as it is.
Try it out and comment


- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā2020-09-28 12:42 PM
PS. Regarding Moonlight's recommendations I think val_TSOM = 0 is perfect in the master script, the master script isn't executed
Software Engineer, Library
Graphisoft SE, Budapest
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā2020-09-28 01:04 PM
1. Read the manual's GDL styling ... and start by adding spaces for god's sake, you're not saving bytes on your storage device worth considering and you're making reading the script a lot harder on everybody including yourself.Yeah, sorry about that, I'm a bit of a novice regarding this and I'm usually the only one reading these scripts. Let me know if the below is a bit easier to read.
t=REQUEST("ASSOCLP_PARVALUE","gs_LTrans",trans_name,type_T,flag_T,dim1,dim2,bTsom)
bTsom = bTsom
IF bTsom=0 THEN
stTransCode = ""
ELSE
stTransCode = "T"
ENDIF
TEXT2 0,0,bTsom
TEXT2 0,-.5,stTransCode
PS. Regarding Moonlight's recommendations I think val_TSOM = 0 is perfect in the master script, the master script isn't executed after any script, only before. It needs to be initialized before the request, for the case the request fails.Thanks Peter, you were certainly correct about the val_TSOM (now bTsom per moonlights comments) I was getting an uninitialized variable warning without it.
Also the using variables instead of parameters was a lot easier (I was still having issues using the string parameter I had set up for some reason)
The script works "perfectly" now (as far as I will ever know anyway lol).
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā2020-09-28 07:23 PM
Braza wrote:
Did you try to put the REQUEST on the Master Script? Or even in the Parameter Script?
Moonlight wrote:
copied from REQUEST OPTIONS > Request Parameter Script Compatibility > Page 481
ie: it means, that using request in Parameter Script or in Master Script were it's part of the script is being interpreted as Parameter Script will cause trouble

Perhaps my GDL kung fu is kind of "freestyle".

Thanks guys for the info.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā2020-09-29 03:02 AM
Moonlight wrote:
@MICHAEL ISERIEF
Using requests or any of their versions, and I quote from ArchiCAD's 23 GDL Reference GuideCompatibility up to ARCHICAD 19: The use of most requests in parameter scripts (or master scripts run as parameter script) could result in unreliable returned values.
copied from REQUEST OPTIONS > Request Parameter Script Compatibility > Page 481
ie: it means, that using request in Parameter Script or in Master Script were it's part of the script is being interpreted as Parameter Script will cause trouble
ASSOCLP_PARVALUE is ok to use in the parameter and master script, check page 482.
