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

GDL IN/OUT and Arrays

Matthew Johnson
Booster
Trying to update our zone GDL to automatically calculate occupancy numbers using use tables from the Building Code. I'm using an external text file to hold the table data so that it can be updated if the Building Code changes.
!-- Getting NCC Table D1.13 values

dim value_use[], value_rate[]

filename= "NCCTableD113.txt"
ch1=OPEN("TEXT",filename,"SEPARATOR='\t',MODE=RO,LIBRARY")

!--counting the total number of rows
row=0
do
row= row+1
n=INPUT(ch1,row,1,string1)
while n>-1

!--reading the first column for NCC_TableD113_Use
for k= 1 to row-1
n=INPUT(ch1,k,1,string1)
value_use= string1
next k

!--reading the second column for NCC_TableD113_Rate
for m= 1 to row-1
n=INPUT(ch1,m,2,string2)
value_rate= string2
next m

CLOSE (ch1)

VALUES "NCC_TableD113_Use" value_use, custom
Not having done much work yet with arrays I'm now stuck as to the next step to use the value the user selects from the drop down for NCC_TableD113_Use to select the matching value for the NCC_TableD113_Rate.

Can anyone suggest some code or point me in the right direction for a guide for this?
Matthew Johnson - P O W E . Architects
AC25, Windows 10 64bit
Dell Precision 5520 i7 w/ Nvidia Quadro M1200 4K dual
I'd rather be sailing.
3 REPLIES 3

Juha Vesen
Newcomer
Hello,

If you are just filling the NCC_TableD113_Rate with the chosen NCC_TableD113_Use then
this should do the job.

Two parameters needed; NCC_TableD113_Use (string) and NCC_TableD113_Rate (number)

!-- Getting NCC Table D1.13 values 

dim value_use[], value_rate[] 

filename= "NCCTableD113.txt" 
ch1=OPEN("TEXT",filename,"SEPARATOR='\t',MODE=RO,LIBRARY") 

!--counting the total number of rows
do
row= row+1
n=INPUT(ch1,row,1,string1)
while n>-1

!--reading the first column for NCC_TableD113_Use
for k= 1 to row-1
	n=INPUT(ch1,k,1,string1)
	value_use= string1
next k
values "NCC_TableD113_Use" value_use, custom

!--reading the second column for NCC_TableD113_Rate 
for k= 1 to row-1
	n=INPUT(ch1,k,1,string1,string2)
	if NCC_TableD113_Use = string1 then
		values "NCC_TableD113_Rate" string2
	endif
next k

CLOSE (ch1)

Hope this works.

PS. What kind of a boat are you sailing?
--
Juha Vesen
ArchiCAD 4.1 --- 20
Mac Intel 2.5 GHz Intel Core i7 16Gb | OSX 10.10

Matthew Johnson
Booster
Juha,

Thanks for the assist. Works well and simple code keeps it tidy.

PS: the avatar is the sail from my Cobra catamaran. Don't get to sail it much since I had my ankle reconstructed. Spend most of my spare time now teaching kids to sail.
Matthew Johnson - P O W E . Architects
AC25, Windows 10 64bit
Dell Precision 5520 i7 w/ Nvidia Quadro M1200 4K dual
I'd rather be sailing.

Juha Vesen
Newcomer
Nice to hear that the problem was solved.

Sorry about the ankle...as they say: "keelboats are for elderly
people" 😉

Regards, Juha
--
Juha Vesen
ArchiCAD 4.1 --- 20
Mac Intel 2.5 GHz Intel Core i7 16Gb | OSX 10.10

Didn't find the answer? Start a new discussion

Labels

Still looking?

Browse more topics

Back to forum

See latest solutions

Accepted solutions

Start a new discussion!