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: 
Not applicable

Possible to change field - formula with button click

Hi,

i'm working with QlikView 10.

I wonder if it's possible to change the field-formula of a listbox in a macro?

The initial field-formula is =if(aggr(sum(BETRAG_VP) <> 0 , [KONTO_LANG]),[KONTO_LANG])

after button click, the formula should be =if(aggr(sum(BETRAG_LP) <> 0 , [KONTO_LANG]),[KONTO_LANG]) (difference is: BETRAG_VP <> BETRAG_LP).

Unfortunately, i don't know, how to do this. Can anybody help me?

Thanks,

David

9 Replies
Jason_Michaelides
Luminary Alumni
Luminary Alumni

Hi David,

I don't think you need a macro here.  Put your formula in a variable e.g. vExpression and use the External > Set Variable action within a standard button to change it.

Hope this helps,

Jason

llauses243
Creator III
Creator III

Hi,

This is my offer,pls to see image adjust

Good luck, Luis

trigger flip flag w variable.jpg

Jason_Michaelides
Luminary Alumni
Luminary Alumni

Remember that in v10 actions are multi-threaded whereas macros use only a single CPU core. Always best to avoid macros if there's a simple alternative.

Not applicable
Author

Thanks a lot.

So, i combined you two solutions.

the expression is: =if(aggr(sum($(vFieldCost)) <> 0 , [KONTO_LANG]),[KONTO_LANG])

with button click i change the value of vFieldCost.

So, one question: is it possible to use a condition expression for the value attribute under "External > Set Variable action"?

like: =if($(vFieldCost) = 'BETRAG_VP', 'BETRAG_LP', 'BETRAG_VP')

if i used the named condition, qlikview set the variable to "-".

Jason_Michaelides
Luminary Alumni
Luminary Alumni

Should be fine to do that.  Can you post your qvw and I'll take a look?

Jason

Not applicable
Author

jo, i created a demo project with the same behavior

llauses243
Creator III
Creator III

Hi,

This is my offer,pls to see image adjust

Good luck, Luis

Not applicable
Author

hey,

that's working very fine.

Thanks a lot!

David

Jason_Michaelides
Luminary Alumni
Luminary Alumni

Yep - Luis's solution is what I would also advise. Always try to use the native functionality if possible!