Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content
Announcements
Qlik Launches Open Lakehouse and advanced agentic AI experience in Qlik Answers! | LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
nigharikkha
Contributor II
Contributor II

Loop Through Computation

Hi All,

I have the following feature to be implemented in QlikView. I want to know if this is possible or not. Please help.

I have a table containing the following data. I have to display a computed value in the textbox which will go through all the selected rows in the table and do the logical operation.

nigharikkha_0-1644392224497.png

 

PseudoCode:

TTF = 0
For each row
{
     If (Fail = 0)
          TTF = TTF +(StopTS - StartTS)
     If (Fail = 1)
          TTF = TTF +(FailTS - StartTS)
          Break the loop if Fail = 1
}
Display TTF in Text Box

 

 

Please help me if this is something possible in QlikView and how.

What logic can be used?

Whether the logic can be implemented in the Textbox itself or should we use the Module?

 

Thanks

Labels (4)
3 Replies
marcus_sommer

Real loop-calculations aren't possible within the UI. But quite often there are other ways to reach the same results. In your case it might be something like:

sum(aggr(if(Fail, Fail - Start, End - Start), Label, Fail))

In many scenarios it's preferable to transfer such logic at least partly within the script by flagging the cases and calculating there the duration and within the UI it's just enough to use a sum() or count() maybe with an optional  set analysis to get the wanted results.

- Marcus

 

nigharikkha
Contributor II
Contributor II
Author

Thanks for the clarification, Marcus.

MarcoWedel

Is this question related to https://community.qlik.com/t5/QlikView-App-Dev/Calculate-all-row-values/td-p/1890740 ?

Your example shows a table sorted by Fail. As you only want to include the first occurrence of Fail=1, the result would depend on the interactive sort order of this table which does not impact the TextBox calculation per se.