License Delivery maintenance is expected to occur on Saturday, November 30, between 8 AM and 11 AM CET. This may cause a short 3-hours outage in which license-related tasks: license key upload, download, update, SSA validation, access to the license pool and Graphisoft ID authentication may not function properly. We apologize for any inconvenience.
Libraries & objects
About Archicad and BIMcloud libraries, their management and migration, objects and other library parts, etc.

Error when writing/reading an array

TomWaltz
Participant
This is kind of a strange problem.

I am reading a Text file into an Array:
	DO 
		n = INPUT (ch1, i, 1, keynote) 
		IF n > 0 AND VARTYPE (keynote) = 2 THEN 
			sarray = keynote 
			j = j + 1 
		ENDIF 
		i = i + 1 
	WHILE n > 0 
...which I am later in the script trying to retrieve:
	i = 1
FOR i = 1 to arrayLength
		split_char = ",," ! Two commas, field delimeter
		keynote = sarray
		test_text = keynote
		txlen = STRLEN (keynote)
		tx_split = STRSTR (keynote, split_char) 
	
		IF tx_split > 0 THEN	! If there is a Split Character found
			keynote_num = STRSUB(keynote, 1, tx_split-1)
			keynote_text = STRSUB(keynote, tx_split+2, txlen)
		ELSE
			keynote_num = keynote
			keynote_text = " "
		ENDIF
		GOSUB 110
		GOSUB 120
	NEXT i
Subroutines 110 and 120 actualy try to process the text to place it on the drawing.

This script does not have any errors when I run "Check Script", but I get an error when I try to save the object. The debugger tells me I have a "String type expression required" error on the line that reads "keynote = sarray"

What is really odd is that if I replace the with a number, like [4], the whole thing works.

Is there something obvious I am missing here?
Tom Waltz
10 REPLIES 10
Rob
Graphisoft
Graphisoft
ok then, I was just checking...

back to your previous question.
when you are reading the values to the array it does not matter wether the value is a string or a number

so:

sarray=""

for rowNum=1 to 10
n=input(ch1,rowNum,1,sarray[1])
n=input(ch1,rowNum,2,sarray[2])
n=input(ch1,rowNum,3,sarray[3])
next rowNum

****

text file: blabla,1,0

sarray[1]=blabla
sarray[2]=1
sarray[3]=0
::rk