We value your input!
Please participate in Archicad 28 Home Screen and Tooltips/Quick Tutorials survey

GDL
About building parametric objects with GDL.

GDL Text Addon: String detection

Jochen Suehlo
Moderator
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?
Jochen Suehlo . AC12-27 . MAC OSX 14.4 . 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
Jochen Suehlo
Moderator
Thank, that works great without error
Jochen Suehlo . AC12-27 . MAC OSX 14.4 . WIN11
GDL object creation: b-prisma.de