This is not entirely accurate...Just to be clear, [MeasureCalculatedTest2] doesn't need DynamicVariables=1.
When you use [MeasureNumber:], you need DynamicVariables=1
When you use MeasureNumber, you don't need DynamicVariables=1
The difference between [MeasureNumber:] and [MeasureNumber] is that the first is returning the number value of the MeasureNumber measure, and the second is returning the string value, that's why it doesn't work.
To explain why it doesn’t work.
[MeasureNumber] doesn’t work because it is a string, and a formula expects a valid number to perform calculations.
You can actually perform calculations with strings, but only if those strings are valid numbers, in your case, [MeasureNumber] is returning and invalid number as its string value, that number is invalid because it contains a comma instead of a dot as number separator. If you enable your substitution to substitute that comma with the dot, then it should also work (but it will need DynamicVariables=1)
First - Section Variables, either [SectionName] or [SectionName:] always require DynamicVariables=1 on any measure or meter they are used on. Always.
Second - [MeasureNumber] is not working for him, not because it is getting the string value particularly, the text value in the file is 12345.67 which has no commas and is a valid number. The reason it isn't working is because it is like this:
Code:
12345.67
If you remove the carriage return/linefeed sequence from the text file, then all of these works just fine:
Code:
[MeasureNumber]Measure=WebParserURL=#Path_2#RegExp=(?siU)^(.*)$StringIndex=1[MeasureCalculatedTest1]Measure=CalcFormula=[MeasureNumber:] * 0.000911DynamicVariables=1[MeasureCalculatedTest2]Measure=CalcFormula=MeasureNumber * 0.000911[MeasureCalculatedTest3]Measure=CalcFormula=[MeasureNumber] * 0.000911DynamicVariables=1
You can also leave the carriage return / linefeed in the file, but change the RegExp to:
RegExp=(?siU)^(.*)\r\n$
Note that this only matters when you are trying to do math with the "string" value of the measure. The Calc measure will try to turn the string into a number, but will fail to do so. When you are using the "number" value of the measure, the carriage return / linefeed are just thrown away. The way it works with real numbers is that the formula functionality will evaluate the number, and if it hits a non-numeric character, it just stops and uses whatever number it was able to get. That is why earlier when we had a string like 123,456.78 you ended up with a number value of 123.
Only the Formula=MeasureNumber * 0.000911 construct does not require DyanmicVariables=1.
However - Keep in mind that the use of Formula=[MeasureNumber] * 0.000911 which is getting the string value of the measure, will cause a single error in the log when first loaded or refreshed. You need the Disabled / !EnableMeasure approach to avoid that.
Code:
[MeasureNumber]Measure=WebParserURL=#Path_2#RegExp=(?siU)^(.*)$StringIndex=1FinishAction=[!EnableMeasure MeasureCalculatedTest3][!UpdateMeasure MeasureCalculatedTest3][MeasureCalculatedTest1]Measure=CalcFormula=[MeasureNumber:] * 0.000911DynamicVariables=1[MeasureCalculatedTest2]Measure=CalcFormula=MeasureNumber * 0.000911[MeasureCalculatedTest3]Measure=CalcFormula=[MeasureNumber] * 0.000911DynamicVariables=1Disabled=1
Statistics: Posted by jsmorley — Yesterday, 11:45 pm