We value your input!
Please participate in Archicad 28 Home Screen and Tooltips/Quick Tutorials survey

Libraries & objects
About Archicad and BIMcloud libraries, their management and migration, objects and other library parts, etc.

Can't create textblock with string from REQUEST(...

Anonymous
Not applicable
Hello!

My code:

REQUEST ("Zone_category", "", catname, code)
TEXTBLOCK "MY_TEXTBLOCK_1" 0, 5, 0, 1, 1, 0, catname

I get the error "requires an expression of type string"

But:

catname = "tmp_cat_name"
TEXTBLOCK "MY_TEXTBLOCK_1" 0, 5, 0, 1, 1, 0, catname

work without errors.

How I can get category name and create textblock with it?

Help me, please!)
7 REPLIES 7
Jochen Suehlo
Moderator
Maybe this is a bug in ArchiCAD. I dont't know.
But this works, if you want to use TEXT2:
x = REQUEST ("Zone_category", "", catname, code)
TEXT2 0, 0, catname
Jochen Suehlo . AC12-27 . MAC OSX 14.4 . WIN11
GDL object creation: b-prisma.de
Maybe at first before request:

catname = ""

guessing...had something similar lately.

Best Regards,
Piotr
Anonymous
Not applicable
I tried:

catname = ""
REQUEST ("Zone_category", "", catname, code)
TEXTBLOCK "MY_TEXTBLOCK_1" 0, 5, 0, 1, 1, 0, catname

gives an error too (
Anonymous
Not applicable
Tsepov wrote:
I tried:

catname = ""
REQUEST ("Zone_category", "", catname, code)
TEXTBLOCK "MY_TEXTBLOCK_1" 0, 5, 0, 1, 1, 0, catname

gives an error too (
It should work normally.
I do not think that you accidentally forgot about the paragraph, but here is the complete code (simplified, without coefficients) just in case.
Catname = ""
Catcode = ""
	QW= REQUEST("Zone_Category", "", Catname, Catcode)
PARAGRAPH "NAMECAT" 2, 0, 0, 0, 1
	""+Catname
	ENDPARAGRAPH

TEXTBLOCK "CAT" 0, 5, 0, 1, 1,1,"NAMECAT"
RICHTEXT2  0, 1, "CAT"
Barry Kelly
Moderator
I find with REQUEST you always have to say xxx = REQUEST...
This is because it returns a value to xxx if the request is successful or not.
As well as returning the actual values you were requesting in the first place.

Barry.
One of the forum moderators.
Versions 6.5 to 27
i7-10700 @ 2.9Ghz, 32GB ram, GeForce RTX 2060 (6GB), Windows 10
Lenovo Thinkpad - i7-1270P 2.20 GHz, 32GB RAM, Nvidia T550, Windows 11
Anonymous
Not applicable
Its work!

Catname = ""
Catcode = ""
QW= REQUEST("Zone_Category", "", Catname, Catcode)
PARAGRAPH "NAMECAT" 2, 0, 0, 0, 1
""+Catname
ENDPARAGRAPH

TEXTBLOCK "CAT" 0, 5, 0, 1, 1,1,"NAMECAT"
RICHTEXT2 0, 1, "CAT"


SL_GDL, many thanks for the help!
Anonymous
Not applicable
to avoid errors with str var type after REQUEST it is better to do so:

QW= REQUEST("Zone_Category", "", Catname, Catcode)

IF QW <> 0 THEN ! if answeres more then 0
Catname_ = Catname
ELSE
Catname_ = ""
ENDIF

PARAGRAPH "NAMECAT" 2, 0, 0, 0, 1
Catname_
ENDPARAGRAPH

TEXTBLOCK "CAT" 0, 5, 0, 1, 1,1,"NAMECAT"
RICHTEXT2 0, 1, "CAT"