Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Dynamic update defined by sum of records

Hi, everyone!

I have example with simple data set:

 

 

IDNameSalesFlagResult
1Name1231
1Name1111
1Name101
2Name2-281
2Name2221
3Name3540
3Name3-20
4Name431
4Name431
5Name51001
5Name581

Using Dynamic update i need to set Done value into Result field for those IDs, which in TOTAL have Sum({<Flag={1}>}Sales)>=30.

So the expected result should be (applied only for records with 1 and 5 id):

 

IDNameSalesFlagResult
1Name1231Done
1Name1111Done
1Name101Done
2Name2-281
2Name2221
3Name3540
3Name3-20
4Name431
4Name431
5Name51001Done
5Name581Done

I tried to use if statement to define necessary records, but sum function in Dynamic update isn't working.

Will be grateful for any help.

Thanks.

1 Solution

Accepted Solutions
MK_QSL
MVP
MVP

9 Replies
MK_QSL
MVP
MVP

IF(SUM({<Flag = {1}>}Total <ID> Sales) >=30,'Done')

Anonymous
Not applicable
Author

Thanks, but if you suggested you use something like this:

=if(SUM({<Flag = {1}>}Total <ID> Sales) >=30, 'UPDATE Main SET "Result" = ' & chr(39) & 'Done' & chr(39) & ';')



Unfortunately it's not working

MK_QSL
MVP
MVP

'UPDATE Main SET "Result" = ' & chr(39) & 'Done' & chr(39)& ';')

What is this? and why you are using this?

I never suggested that..



Anonymous
Not applicable
Author

I'm using this, because i need update Main table via Dynamic Update statement, which is linked to the button.

So the idea is to define somehow Dynamic Update statement (Update Table.... SET... WHERE...), which will update only necessary records. Comparing with total sum per each ID should be done inside Dynamic Update statement (not by creating some additional flag in the script).

MK_QSL
MVP
MVP

Where are you trying to use this?

At front end?

At back end?

Can you provide qvw or qvf with sample data along with your work out so that we can understand what exactly you are doing? Because from your above explanation, I don't understand what exactly you are trying to do.

It would be good if you ask question with proper description in the initial post, which will make our job easy to understand and answer...

Anonymous
Not applicable
Author

'Dynamic update' action is always done in front-end.

In my post i already attached xls and qvw (qvw is already with button, which should update table)

Thanks.

MK_QSL
MVP
MVP

Try something like this

MK_QSL
MVP
MVP

or this

Anonymous
Not applicable
Author

Thanks a lot!