Exponentiation Operator/Squaring in a Calculated Column
Has anyone successfuly used a formula in a Calc Column that involves squaring a number or part of a formula (or a larger power)?
Even the simplest such formula 2^2 doesn't seem to be calculating and only returns zeros.
Is this a Logi bug, or am I not using the correct syntax?!
<CalculatedColumn
Formula="2^2"
ID="calcSQUARE"
/>
Surely this ought to be this simple?!
https://devnet.logianalytics.com/hc/en-us/articles/4419715083031-Operators
-
Hey Sebastian Verity,
I am seeing the same behavior in 14.1 SP2 (with ScriptingLanguage="JavaScript" in my _Settings.lgx)
I also tried "2**2" and "Math.pow(2,2)" directly in formulae without success. You could presumably use JavaScript to apply these options to the calculation but that will add some complexity to your Definition. "Exp(2)" gave me a result but it was "7.xxxxxxx" and not "4", so that's a bust, too.
Have you opened a support ticket with Logi?
Regards,
Johnny0 -
No not yet. I wanted to rule out 'user error' first! :D
Thanks for checking. Will log a ticket.
0 -
The following works for me in 14.1.099-SP2
<Report ID="LogiForum.exponents">
<Body>
<DataTable ID="dt">
<AutoColumns />
<DataLayer Type="Static">
<StaticDataRow Row="1" />
<StaticDataRow Row="1" />
<StaticDataRow Row="1" />
<StaticDataRow Row="1" />
<StaticDataRow Row="1" />
<StaticDataRow Row="1" />
<StaticDataRow Row="1" />
<StaticDataRow Row="1" />
<StaticDataRow Row="1" />
<StaticDataRow Row="1" />
<StaticDataRow Row="1" />
<SequenceColumn ID="seq" />
<CalculatedColumn Formula="Math.pow(@Data.seq~, 2)" ID="Exp2" />
<CalculatedColumn Formula="Math.pow(@Data.seq~, 3)" ID="Exp3" />
</DataLayer>
</DataTable>
</Body>
<ideTestParams />
</Report>Javascript functions should not be quoted in Logi Calculated Columns.
Formula: Math.pow(@Data.seq~, 2)
0 -
Thanks both VISUI & Johnny Stevens the Math.pow solution worked. 👍🏻
1
Please sign in to leave a comment.
Comments
4 comments