BIM Coordinator Program (INT) April 22, 2024
Find the next step in your career as a Graphisoft Certified BIM Coordinator!
GDL
About building parametric objects with GDL.

GDL Text Addon: String detection

Joachim Suehlo
Advisor
I know, we had this issue some years ago:
If I use TEXT Addon and import multi line text file, the GDL Interpreter uses to define the vartype of the text the same kind as the 1st character in one line.
So if the line starts with 0.012, the rest will interpreted as number. This causes that text operations with STW etc. will give an error message, because a string was expected.
The solution for this issue was to put a # in front of every line, so the following will be detected as text.
If I get the textfile from an interactive schedule, I do not want to have column with # in front.
Using VARTYPE to detect the vartype, gives an error too:
IF VARTYPE(myText) = 2 THEN myText = myText + str_TEXT_trenner ! STRING
IF VARTYPE(myText) = 1 THEN myText = STR(myText, 4, 3) + str_TEXT_trenner ! NUMBER

Any new ideas for this?
Joachim Suehlo . AC12-27 . MAC OSX 13.5 . WIN11
GDL object creation: b-prisma.de
2 REPLIES 2
Dominic Wyss
Booster
I had the same issue with ZIP codes. The following code worked fine for me (data mode):

_prjChannel = open("DATA", fileSettings, "SEPARATOR='\t', MODE=RO, LIBRARY")
_nVal = input(_prjChannel, "thirdPLZ",   1, thirdPLZ)
	! Postleitzahl abfangen und in Zeichenkette umwandeln
	if vartype(thirdPLZ) = 1 then thirdPLZ = str("%^4.0", thirdPLZ)
AC27 CHE - macOS Ventura M1
Joachim Suehlo
Advisor
Thank, that works great without error
Joachim Suehlo . AC12-27 . MAC OSX 13.5 . WIN11
GDL object creation: b-prisma.de
Learn and get certified!

Didn't find the answer?

Check other topics in this Forum

Back to Forum

Read the latest accepted solutions!

Accepted Solutions

Start a new conversation!