Skip to main content

Exponentiation Operator/Squaring in a Calculated Column

Comments

4 comments

  • Sebastian Verity

    Thanks both VISUI & Johnny Stevens the Math.pow solution worked. 👍🏻

    1
  • Johnny Stevens

    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,
    Johnny

    0
  • Sebastian Verity

    No not yet. I wanted to rule out 'user error' first! :D

    Thanks for checking. Will log a ticket.

    0
  • VISUI

    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

Please sign in to leave a comment.