Text File (database) INPUT/READ for a calculating object (?)
Anonymous
Not applicable
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2011-05-09 01:41 AM
2011-05-09
01:41 AM
OK, I give up -
FILE I/O is driving me nuts!
Attached is a sample text file that was generated by a simple
LIST scheme.
It lists certain attributes of given objects that are placed on the plan view
of a story, with discreet layers and IDs set to each object.
My goal is to create a "Calculating and Report" object that will be
able to READ this file, perform certain summing and subtracting
operations and generate a 2D "Report Object".
Let me explain what you are looking at:
GF is the Ground Floor story, in this case all objects are on it.
|XX| are the various layers.
I would need to generate a graphic list of all objects on layer |01|,
sorted by ID (next field from the layer), display the math routine
per object, display the result of each routine, and then display
the SUM of results for all these routines.
I know this should be achievable via TEXT or DATA file INPUT or READ,
and should use Arrays in some way with a counter loop,
but besides looping my CPU up to 57% I am going nowhere...
and this is with Cookbook 2, GDL reference manual and Andy Watson's
GDL Handbook.
If anyone out there has the time to explain this at idiot-speak level,
it would be much appreciated and you would be blessed with good fortune,
many children and a happy wife!!!
Gil
5 REPLIES 5
Anonymous
Not applicable
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2011-05-09 01:47 AM
2011-05-09
01:47 AM
PS: Take note that the combination of Story, Layer & ID form
a very discreet triple power ID for each row in the file -
which is the key to making this data useful...
🙂
a very discreet triple power ID for each row in the file -
which is the key to making this data useful...

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2011-05-09 08:32 AM
2011-05-09
08:32 AM
Try this part of script, which I did not tested, but I think it should work:
DIM mti[][5] !Array for storing the values of the text file
ix=0
ch01 = OPEN("TEXT","C:\GDL\DATA\Database2.txt","SEPARATOR='|',MODE=RO,FULLPATH")
DO
ix=ix+1 !ix is the variable linecounter, 5 columns are given
n=input(ch01, ix, 1, mti[ix][1], mti[ix][2], mti[ix][3], mti[ix][4], mti[ix][5])
WHILE n>-1
close ch01
manu=ix-1 !number of Array lines with content
DIM mti[][5] !Array for storing the values of the text file
ix=0
ch01 = OPEN("TEXT","C:\GDL\DATA\Database2.txt","SEPARATOR='|',MODE=RO,FULLPATH")
DO
ix=ix+1 !ix is the variable linecounter, 5 columns are given
n=input(ch01, ix, 1, mti[ix][1], mti[ix][2], mti[ix][3], mti[ix][4], mti[ix][5])
WHILE n>-1
close ch01
manu=ix-1 !number of Array lines with content
Jochen Suehlo . AC12-28 . MAC OSX 14.4 . WIN11
GDL object creation: b-prisma.de
GDL object creation: b-prisma.de
Anonymous
Not applicable
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2011-05-10 09:14 PM
2011-05-10
09:14 PM
Hi Joachim,
I managed to get things working, sort of.
How can I get an array to store something like the
following string, which appears on th 4th column of the source file
(( 1.00+ 0.00) /2) * 1.00
as text? (brackets, spaces, operators etc - all as a text string)?
I tried setting the variable to text, directly (var1=abc)
and also via the parameters - but I keep getting "1" as a result.
???
🙂
Gil
I managed to get things working, sort of.
How can I get an array to store something like the
following string, which appears on th 4th column of the source file
(( 1.00+ 0.00) /2) * 1.00
as text? (brackets, spaces, operators etc - all as a text string)?
I tried setting the variable to text, directly (var1=abc)
and also via the parameters - but I keep getting "1" as a result.
???
Gil

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2011-05-11 08:35 AM
2011-05-11
08:35 AM
With that script I get as result 0.5 , which is the correct calculation, and not 1.
If you want to have the formula, you must write in the textfile
"(( 1.00+ 0.00) /2) * 1.00"
with quotes.
In the gsm you must then delete the quotes with a string-operation.
If you want to have the formula, you must write in the textfile
"(( 1.00+ 0.00) /2) * 1.00"
with quotes.
In the gsm you must then delete the quotes with a string-operation.
Jochen Suehlo . AC12-28 . MAC OSX 14.4 . WIN11
GDL object creation: b-prisma.de
GDL object creation: b-prisma.de
Anonymous
Not applicable
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2011-05-11 11:23 AM
2011-05-11
11:23 AM
Hi Joachim,
Thanks - I did something very similar,
you can see in my newest plea for more help - LOL!
🙂
Gil
Thanks - I did something very similar,
you can see in my newest plea for more help - LOL!
Gil