cancel
Showing results for 
Search instead for 
Did you mean: 
EN
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

GDL reading from txt

When reading from a txt-file to a GDL-object, all numbers are read as numbers. When I put in a date, like 2012-01-20 in the txt file, I want to read it as a string. How do I do that?

In the workaround I use now, I put in the date as separate fields: 2012;01;20 and then convert them independently to strings. But then the zeros in the beginning of a number dissappear so it shows the date as 2012-1-20. I'd like it to be shown as 2012-01-20.

Please help!

I have done scripting in Java, VBscript and PHP. To me GDL seems very odd. It behaves weird, almost buggy. I can't point my finger at it yet, but there's something...
3 Replies 3
Anonymous
Not applicable
Hello,

I think you should determine if the variable is
considered as a number or as a string with
VARTYPE command and convert on the fly.

If you want to convert a string to number then
use SPLIT and if you want to convert a number
to a string then use STR.

Hope this helps (writing this on a sofa with a mobile
phone - so no examples handy).

Regards, Juha
Pertti Paasky
Expert
..or You can put #2012-01-20 in the textfile and then GDL reads it as a string.
- AC-24 FIN - WIN 10 - HP Zbook -
“A winner is just a loser who tried one more time.”
George M. Moore, Jr.
Anonymous
Not applicable
Kiitos!

Using the #2012-01-24 method and then removing the first character. Works perfectly. That was simple...

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!