Create account / Log in

How to Compare Properties Between Multiple Pieces

Talk about module design ideas and techniques.

Moderators: Tim M, uckelman

How to Compare Properties Between Multiple Pieces

Postby twenck » September 2nd, 2018, 4:32 pm

Can someone show me how to compare the value of properties between multiple pieces in a zone?

Let's say I have a Dynamic Property named "SMA".

I want to compare the value of SMA between all pieces in a zone named "TestZone" and determine the lowest value.

How could I do that?


Tom
twenck
 
Posts: 22
Joined: October 27th, 2017, 11:15 pm

Re: How to Compare Properties Between Multiple Pieces

Postby MKerby » September 18th, 2018, 2:44 am

Create a Global Property in the Zone for LowestSMA and one called LowestSMAOwner. Invoke a Key Command which will have each piece in the zone check the LowestSMA and replace with piece SMA if lower and then write the piece name in LowestSMAOwner.
MKerby
 
Posts: 58
Joined: November 8th, 2010, 3:46 pm
Location: DFW Texas

Re: How to Compare Properties Between Multiple Pieces

Postby twenck » September 19th, 2018, 11:12 pm

This was very helpful and clear. Worked perfectly. Thanks.

For anyone watching, you would need a command to first reset LowestSMA to the highest possible value. Otherwise the previous value of LowestSMA may be lower than any of the current piece SMA values, and that old lower LowestSMA would persist.
twenck
 
Posts: 22
Joined: October 27th, 2017, 11:15 pm


Return to Module Design

Who is online

Users browsing this forum: No registered users and 1 guest