5 Replies Latest reply: Jul 21, 2010 7:11 AM by Adriano Visconti RSS

    Operations with variables

      Hello everyone

      The problem is this: mathematical operations between variables do not work well !

       

      This works well:

      =$(v_Saldo) / $(v_Saldo_ap_1_mobile)

       

      This does not return anything:

      =($(v_Saldo) / $(v_Saldo_ap_1_mobile))-1

       

      It is a "bug" in the program?

      Thanks, Adriano

       

        • Operations with variables

          Hi

          I test both expression and both work well for me.

           

          Anders

            • Operations with variables

              Hi

              I also tested both, and both work for me, so I would assume it's something to do with your variable definitions.

              Can you tell us how the variables are defined, what do they contain?

                • Operations with variables

                  Hi, and thanks for your reply !

                  The variables are complex. Here is their definition:

                  v_Saldo --> If([Flag saldo iniziale]='SI',Sum([Partitario - Importo Con Segno]),Sum(If([Partitario - Flag Saldo apertura]='NO',[Partitario - Importo Con Segno])))

                  v_Saldo_ap_1_mobile -->

                   

                  If

                  (

                   

                  ([Flag saldo iniziale]='SI',Sum({$<[Partitario - Anno Data Operazione] = {$(#=Only([Partitario - Anno Data Operazione])-1)} >} [Partitario - Importo Con Segno])

                   





                  Adriano

                  The variables are complex

                    • Operations with variables

                      Hi

                      You might try changing the location of your SUM function in the variable definition to the outside of the formula, this might help, so your variables wiil look like:

                       

                      =SUM(If([Flag saldo iniziale]='SI',[Partitario - Importo Con Segno],If([Partitario - Flag Saldo apertura]='NO',[Partitario - Importo Con Segno])))


                      and

                       

                      =SUM(If(([Flag saldo iniziale]='SI',{$<[Partitario - Anno Data Operazione] = {$(#=Only([Partitario - Anno Data Operazione])-1)} >} [Partitario - Importo Con Segno]) )


                      Second, if this doesn't work then you could calculate the value of variable 1 in one column, then variable 2 in a second column and then create a third column which has a formula such as:

                       

                      =Column(1) - Column(2) - 1