Groupexpression with strings

   1596   3   0
User Avatar
Member
11 posts
Joined: March 2014
Offline
hey guys,
can somebody please enlighten me?

i don't understand how to deal with the groupexpression node and string-attributes.

I'm playing around with the osm-importer of the gameDevToolset

the incoming data have tons of primitive attributes, i want to use to create groups.

in the groupexpression node (set to primitives) i type the following:

@P.x > 50 —> works, although there is no primitive attribute “P”

@addr_postcode > 1000 —> gives no error, but an empty group, although there are prims with this attribute > 1000

then i realized, that all attributes in the osm geometry are strings, so i tried

atoi(@addr_postcode) > 1000 —> throws a no matching function error

@addr_postcode == ‘10004’ —> throws an undefined binary operator error

can somebody explain how to test for specific strings and how to
convert them to integer/float for testing against numbers
in a groupexpression node?

Thx in advance
User Avatar
Member
323 posts
Joined: Jan. 2015
Online
@addr_postcode == “10004”
if i rememder right
User Avatar
Member
2038 posts
Joined: Sept. 2015
Offline
@P.x > 50 —> works, although there is no primitive attribute “P”

Although not listed all primitives inherently have their ‘centroid’ value accessable with @P

Adding s to your attribute will work;

s@addr_postcode > 1000

Anytime you wish to access user defined attributes outside of the wrangle/node in which they were created you have to let Houdini know their type with a prefix, otherwise it will create a new one with the same name but with a default type and value.
User Avatar
Member
11 posts
Joined: March 2014
Offline
Thank you guys for your thoughts on this,

The solution was a combination of both of your approaches:

when searching for a specific string:

s@addr_postcode == “10004”

When testing against an integer:

atoi(s@addr_postcode) > 1000

Thank you very much!
  • Quick Links