Jump to content

node parameter expression / function question


ford77

Recommended Posts

Hi

I`d like to group RBD objects based on impact.

So far I can do this by adding an emty Hitdata data

with a Hasbeenhit record set to 0

then modifieing it`s value to 1 when the

dophasfield("dopnet",$OBJID,"Impacts","Impacts",0,"impulse")

expression evaluates true. Then I group the objects

with the group expression

dopfield("dopnet",$OBJID,"Hitdata","Options",0,"Hasbeenhit") == 1

The question is, as each rbd object has different

number of impact records, how do I check and filter

each rbd objects to be able to group only objects which have

an impact greater then a certain value?

I have a for loop expression in mind:

for i = 0 to doprecordnum(...impacts...)

if dopfield("dopnet",$OBJID,"Hitdata","Options", i ,"Hasbeenhit") > 10

return 1

else

return 0

can anybody help me with the exact expression syntax?

is it possible to use such expressions/functions in node parameters?

thanks!

Link to comment
Share on other sites

I´m a bit confused to what you are trying to do since dopnumrecords returns number of impacts.

So:

dopnumrecords($DOPNET,$OBJID,"Impacts","Impacts") > 10

Will return 1 if you are having more impacts then 10.

From the help.

EXAMPLES

dopnumrecords("/obj/dopnet1", "object1", "Impacts", "Impacts")

Returns the number of records in the record type called "Impacts"

found in the data called "Impacts", which is owned by the object

"object1"

Link to comment
Share on other sites

DanBode:

Thank you! I found a hip there and I found what I wanted.

mawi:

the dopnumrecords returns the number of impacts of an object.

But the impacts number itself is not enough by itself.

I needed a loop to go through all impact records one by one

and group the objects based on the highest/lowest

impact value. I only wanted to group objects which have

an impulse value higher then a certain value.

Here`s the expression syntax:

{
    if ( dopfield ("..", $OBJID, "Hitinfo", "Options", 0, "hitnum") > 0 )
        for ( i = 0; i < dopnumrecords ("..",$OBJID,"Impacts","Impacts"); i++ )
        {
            if ( dopfield("..",$OBJID,"Impacts","Impacts",i,"impulse") > 10 )
            {
                return $OBJID;

            }
        }
}

Link to comment
Share on other sites

DanBode:

Thank you! I found a hip there and I found what I wanted.

mawi:

the dopnumrecords returns the number of impacts of an object.

But the impacts number itself is not enough by itself.

I needed a loop to go through all impact records one by one

and group the objects based on the highest/lowest

impact value. I only wanted to group objects which have

an impulse value higher then a certain value.

Here`s the expression syntax:

{
    if ( dopfield ("..", $OBJID, "Hitinfo", "Options", 0, "hitnum") > 0 )
        for ( i = 0; i < dopnumrecords ("..",$OBJID,"Impacts","Impacts"); i++ )
        {
            if ( dopfield("..",$OBJID,"Impacts","Impacts",i,"impulse") > 10 )
            {
                return $OBJID;

            }
        }
}

Glad you solved it.

Couldn´t figure out why you were interested in grouping by number of impact records.

Max impulse makes more sense.

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...