Page 1 of 1

Conditional Operators : Meter Width Variables

Posted: March 2nd, 2019, 5:14 pm
by nawuve
Could someone explain to me what is wrong with this code? It does not give either 20 or 10 ([Meter1:W] and [Meter2:W] respectively).

Code: Select all

[WidthCalc]
 Measure=Calc
 Formula=([Meter1:W] < [Meter2:W] ? [Meter1:W] : [Meter2:W])

[Meter1]
 Meter=String
 W=20

[Meter2]
 Meter=String
 W=10

[Result]
 Meter=String
 SolidColor=1
 FontSize=30
 Text=[WidthCalc]

Re: Conditional Operators : Meter Width Variables

Posted: March 2nd, 2019, 5:36 pm
by balala
nawuve wrote: March 2nd, 2019, 5:14 pm Could someone explain to me what is wrong with this code? It does not give either 20 or 10 ([Meter1:W] and [Meter2:W] respectively).
The [WidthCalc] measure requires a DynamicVariables=1 option, because section variables are used.

Additional tip: don't use a Text=[WidthCalc] option on the [Result] meter (which also would require as well a DynamicVariables=1 option in certain circumstances). Instead add a MeasureName=WidthCalc option and replace the text option with Text=%1.

Re: Conditional Operators : Meter Width Variables

Posted: March 2nd, 2019, 6:08 pm
by nawuve
Oh that makes sense, thanks!

Re: Conditional Operators : Meter Width Variables

Posted: March 2nd, 2019, 6:15 pm
by balala
Glad to help.