5 Replies Latest reply: Dec 16, 2011 2:56 PM by Gonzalo Bianchi RSS

    problems with big numbers..

    Gonzalo Bianchi

      Hi everyone...

       

      I have this number (4,0084464e+011) inside my script.. this come from the sum of a field in one table..

       

      Now I need to get the 86% of this number, but my attemps seems to fail miserably...

       

      let por86 = num($(sumatotal)) * 86/100; this is getting the wrong answer 3.44

       

      let por86 = $(sumatotal) * 86/100; this is throwing a script error (probably the way the number is show)..

       

      So How can I calculate this value? Or should I do it in the load of the sum? (didn't try it, this just come into my head)

       

      Thanks...

        • problems with big numbers..
          Stefan Wühl

          Maybe a good idea to do the 86% at a different place...

           

          Where and how do you define your variable sumatotal? Could you post some more lines of your script?

            • problems with big numbers..
              Gonzalo Bianchi

              This is my script

               

              SumaTotal:

                        LOAD

                                  Sum(total_general) as sumtotal

                        Resident

                                  Final1;

               

                        let sumatotal = Peek('sumtotal',0,'SumaTotal');

               

              Where else can I do this??? Mabye port the sum to a number?

               

              I tried this:

               

              SumaTotal:

                        LOAD

                                  Sum(total_general) * 86 / 100 as sumtotal

                        Resident

                                  Final1;

               

              and seems to work, but if this ok?

                • problems with big numbers..
                  Gonzalo Bianchi

                  Ok, I tried some more.. and realize I could fix it, just multiplying it by 1.

                   

                  so this:

                   

                  SumaTotal:

                            LOAD

                                      Sum(total_general) *1 as sumtotal

                            Resident

                                      Final1;

                   

                  will fix the number and allow to make calculus with the number.. don't understand the difference.. but it worked.

                   

                  (in fact I can also do this: Sum(total_general) * 86 / 100 as sumtotal and will work).

                    • problems with big numbers..
                      Stefan Wühl

                      So you've solved your issue? Good to hear!

                       

                      QlikView seems to have some issues with large numbers, interpreting them as string only while loading. Not sure if this is what you see and if this is version specific, but if you are interested in, there are some threads that are related to problems with large number while loading from source.

                       

                      Have a nice weekend,

                      Stefan

                        • problems with big numbers..
                          Gonzalo Bianchi

                          I found some threads about problems with numbers, but usually they involved loading numbers from database, not calculating it. And seems in charts there are no problems with them, I assume they should work. But not, the problem is even when you calculate them.

                           

                          Would be nice to heard a word from qt about why if I just multiply it by 1, it becomes a number again.

                           

                          Thanks anyway...