Choose your top Archicad wishes!

Read more
GDL
About building parametric objects with GDL.
SOLVED!

Number formatting problem with Channel Input

Bruce
Expert

I have a part that opens a .txt file as a channel (TEXT filter), and imports (amongst other things) a date in the dd.mm.yy format.

If the separators used are periods, then everything works fine.

If the separators used are either slashes or hyphens (e.g. dd/mm/yy, or dd-mm-yy) then Archicad will see this as a formula, and give me the result on INPUT before I can do anything with it.

 E.g.

10.11.22 = 10.11.22

10/11/22 = 0.0413

10-11-22 = -23

 

I can get around this by prefixing the date with a character (e.g. ~) to turn it into a string, then run a STRSUB to extract the date - but if I can get around this I would prefer that instead, as this is an extra step for the user in the *.txt file.

 

Any ideas?

Bruce Walker
www.brucepwalker.com
Barking Dog BIM YouTube
Mindmeister Mindmap
-- since v8.1 --
AC27 5003 INT Full | Windows 11 64 Pro | 12th Gen Intel i7-12700H 2.30 GHz | 64 Gb RAM | NVIDIA GeForce RTX 3060 32 Gb
1 ACCEPTED SOLUTION

Accepted Solutions
Solution
runxel
Legend

Bruce, I have bad news for you, I guess. It won't work. The text add-on does some weird auto-casting into types and you simply can not get around that, not even by initializing your variables (as you probably found out already).

The only solution is to either force the input to be recognized as text, or to switch to XML – everything is text there and thus predictable.

Lucas Becker | AC 27 on Mac | Author of Runxel's Archicad Wiki | Editor at SelfGDL | Developer of the GDL plugin for Sublime Text | My List of AC shortcomings & bugs |

«Furthermore, I consider that Carth... yearly releases must be destroyed»

View solution in original post

3 REPLIES 3
Solution
runxel
Legend

Bruce, I have bad news for you, I guess. It won't work. The text add-on does some weird auto-casting into types and you simply can not get around that, not even by initializing your variables (as you probably found out already).

The only solution is to either force the input to be recognized as text, or to switch to XML – everything is text there and thus predictable.

Lucas Becker | AC 27 on Mac | Author of Runxel's Archicad Wiki | Editor at SelfGDL | Developer of the GDL plugin for Sublime Text | My List of AC shortcomings & bugs |

«Furthermore, I consider that Carth... yearly releases must be destroyed»
Bruce
Expert

Thanks runxel.  I guess I'll have to learn XML 🙂

Bruce Walker
www.brucepwalker.com
Barking Dog BIM YouTube
Mindmeister Mindmap
-- since v8.1 --
AC27 5003 INT Full | Windows 11 64 Pro | 12th Gen Intel i7-12700H 2.30 GHz | 64 Gb RAM | NVIDIA GeForce RTX 3060 32 Gb

GDL txt addon uses only a dot/period as a separator no matter what is a local setting.

BTW: I did a little workaround on txt loading lately:

when walking through the external  table (I use it for the tables mostly) I save 2 matrix parameters: First is a string and second is a number. Then to create an output I just merge them together with proper formatting the numbers (STR...). The only drawback is with empty cells.

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!