ford77 Posted November 21, 2011 Share Posted November 21, 2011 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! Quote Link to comment Share on other sites More sharing options...
DanBode Posted November 21, 2011 Share Posted November 21, 2011 It might be helpful to take a look at this old challenge thread. http://forums.odforce.net/index.php?showtopic=4830&hl= 1 Quote Link to comment Share on other sites More sharing options...
mawi Posted November 21, 2011 Share Posted November 21, 2011 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" Quote Link to comment Share on other sites More sharing options...
ford77 Posted November 23, 2011 Author Share Posted November 23, 2011 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; } } } Quote Link to comment Share on other sites More sharing options...
mawi Posted November 23, 2011 Share Posted November 23, 2011 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. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.