Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Iteratively changing a variable within a FOR loop in script

Hi All,

As part of a dashboard I'm creating, I have to calculate factorials of very large numbers and perform computations with them. Because the fact() function in Qlikview only supports values up to 170 (far below the numbers I'll have to work with) I would like to use the log-factorial to do everything. However, there doesn't appear to be a function for this native to Qlikview.

I've figured out a way to calculate it by generating a table counting from 1 to x, taking the log of all of these values, and saving their sum as a variable that I can use later. However, this approach only calculates when I start and doesn't update if I change the value of x. I would like this function, and the calculations I do based on it, to update as the user changes the x value.

I tried to calculate it via a FOR loop that counts i from 1 to x, calculates the log of i, and adds it to the current value of vLFactorial (which is set to zero before the loop is run), but this doesn't appear to be working. I've tried a few different formulations of it to no effect. Does anyone know a way to iteratively update the value of a variable within a FOR loop in the script? I've attached a sample document that shows what I'm trying to do.

Thanks!

-Mike

0 Replies