Jump to content

Can @group_NAMEOFGROUP be a variable?


ianwww

Recommended Posts

In a point wrangle I create a new group, say mynewgroup, and set membership of it based on some criterion.  Later in the wrangle I want to test for membership of that new group.  I can't use inpointgroup because that looks backward to the previous node, where the newly created group doesn't exist.  So, instead I use

if(@group_mynewgroup)
{
	WHATEVER
}

to test for a point's membership of the new group mynewgroup.  To use @group_ syntax I need to hard code the mynewgroup into it.

What if the name of the new group depends on the outcome of some code inside the wrangle so that I need to create the new group name on the fly?

I'd like to be able to use something like
 

string newgroup = concat('group_', 'mynewgroup');

if(@newgroup)
{
	WHATEVER
}

I know this particular code doesn't do it but is there something along these lines that I could use?

Link to comment
Share on other sites

  • 3 weeks later...

As well as setting up a group first time around, also declare a variable for you purpose to:

int result=0;

If(condition){

   @group_grp=1;

   result=1;

}

Later, in the wrangle:

if(result){

   do something;

}

Link to comment
Share on other sites

Thanks for the suggestion but - and I may be misunderstanding something - in your example wouldn't

if(@group_grp)

and

if(result)

be asking the same thing?  Both were manually set to 1 at the same time when condition was met, so result is just a mirror variable isn't it?

Also, I'd still need to hard code the name of @group_grp in advance of knowing what the name should be.

Sorry if I've misunderstood!

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...