cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 
Developer forum

Number formatting problem with Channel Input

Bruce
Advocate

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
http://www.brucepwalker.com
https://www.mindmeister.com/65450406
-- since v8.1 --
AC25 5010 AUS Full | Windows 10 64 Pro | 12th Gen Intel i7-12700H 2.30 GHz | 64 Gb RAM | NVIDIA GeForce RTX 3060 32 Gb
1 ACCEPTED SOLUTION
3 REPLIES 3

Solution
runxel
Ace

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.

Mostly AC 26 on Mac | Author of SelfGDL | Developer of the GDL plugin for Sublime Text |
«Furthermore, I consider that Carth... yearly releases must be destroyed»

Bruce
Advocate

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

Bruce Walker
http://www.brucepwalker.com
https://www.mindmeister.com/65450406
-- since v8.1 --
AC25 5010 AUS Full | Windows 10 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.

Still looking?

Browse more topics

Back to forum

See latest solutions

Accepted solutions

Start a new discussion!