REF COMPONENT Property Script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2005-03-16 04:10 PM
"REF COMPONENT code [, keycode [,
numeric_expression]]
Reference by code and keycode string to a component in an external database. The value to multiply by in the component database can be overwritten by the optional numeric expression specified here"
I have tried several different combinations with my numbers to get this script to work and can not figure out what I am doing wrong. See Below:
IF beam_size='4x6' THEN
IF a<8.00 THEN
REF COMPONENT X31040608 , 80000
ENDIF
Everytime I run a check script I get an error, the one above requests a string type expression.
Any help would be greatly appreciated. Thanks.
Barry Halloran
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2005-03-16 05:28 PM
Can you try this syntax :
REF COMPONENT X31040608 [, 80000 [, 1]]
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2005-03-16 05:36 PM
I tried that before and it returns a Non-Declared index variable error. Thanks.
Barry
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2005-03-16 06:21 PM
The GDL Documentation is not completely clear on this point. May be you should create and declare a Database set where are your components.
Some "Master GDL scripter" can certainly help you more…

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2005-03-16 06:25 PM
Barry

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2005-03-16 10:09 PM
Barry wrote:Hi Barry,
REF COMPONENT X31040608 , 80000
We're back to basic GDL syntax here: X31040608 looks like a variable to GDL, and as an uninitialized variable, its value is zero (0).
If these values are constants, as in your example, they must be in quotes since they are arbitrary text. (Of course, if the code was inside a string parameter or variable, such as strCode, then of course strCode would not be in quotes ... because you want the value of that variable.)
The following example works:
DATABASE_SET "AC_9_US" REF COMPONENT "031-00000", "CSI.11"But, note that "in real life" the DATABASE_SET command belongs in a MASTER_GDL script so that it is only executed once, unless you are pulling things from multiple databases.
HTH,
Karl
PS The above is just for illustration purposes and assumes some logic around the REF COMPONENT, as in Barry's example. If you just want to retrieve a component inside of an object, then use the user-friendly Components section of the GDL editor.
Create a New entry, then use Link to Database Item to create a hard-coded link, like the first line int the screenshot. All fields are locked, and match the database exactly. If you create a new entry and do not link, then you have pop-up menus to choose the database, key, and enter a new or existing code and text, etc. Probably not the greatest idea to do both since you could easily create conflicts with existing codes and names.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2005-03-16 10:35 PM
Barry,
I think you may end up looking at a huge number of IF/THEN statements to select your components if you have very many beam sizes and length combinations. You may find that it is easier to use the various GDL string manipulation functions to "build" the database code from the input parameters, if you encode your beam information into the codes.
Karl
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2005-03-17 04:19 AM
Thanks again for your knowledge. I will give it a shot and let you know the results. I am also taking your advice and looking into some GDL classes.
Barry
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2005-03-17 04:41 AM
That worked. My only problem now is similar to what I had before. I can't figure out why whenever I add a < statement the script fails. For example if the length of the beam:
IF beam_size="4x6" THEN
IF A<8'-0" THEN
REF COMPONENT "X31040608" , "80000"
ENDIF
The script works perfect without the nested IF statement. I must be missing something. Thanks for your help.
Barry

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2005-03-18 02:18 AM
Refer to the GDL manual for the syntax. You can only omit the ENDIF for an IF that has a single statement immediately after the THEN (and thus also has no ELSE clause).
IF expression THEN statement
or
IF expression THEN
group of statements
[optional: ELSE / group of statements]
ENDIF
The key bit that I suppose was not obvious when you looked at the manual is that line breaks are often significant, as in this case.
Karl