Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
cesaryulgon
Contributor II
Contributor II

use of variables in editor module (macro)

hi
I need to read a variable and execute addition, subtraction or multiplication to itself and return the result to the same variable.
thanks for the help
Labels (1)
1 Solution

Accepted Solutions
rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

The QV COM API Guide available here 

https://help.qlik.com/en-US/qlikview-developer/April2019/Subsystems/Automation/Content/QV_Automation...

has details on working with variables.  Basically it's:

Set var = ActiveDocument.GetVariable("varname")  'gets a Variable object

content = var.GetContent.String  'gets variable content

var.SetContent newvalue 'sets variable value

You will probably have to convert the string to number first if you want to do arithmetic. 

-Rob
http://masterssummit.com
http://qlikviewcookbook.com
http://www.easyqlik.com

View solution in original post

4 Replies
Sue_Macaluso
Community Manager
Community Manager

@cesaryulgon Hi, are you using Qlik Sense or View? I would like to move this into the correct product forum. Thanks

Sue Macaluso
cesaryulgon
Contributor II
Contributor II
Author

Qlikview.

rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

The QV COM API Guide available here 

https://help.qlik.com/en-US/qlikview-developer/April2019/Subsystems/Automation/Content/QV_Automation...

has details on working with variables.  Basically it's:

Set var = ActiveDocument.GetVariable("varname")  'gets a Variable object

content = var.GetContent.String  'gets variable content

var.SetContent newvalue 'sets variable value

You will probably have to convert the string to number first if you want to do arithmetic. 

-Rob
http://masterssummit.com
http://qlikviewcookbook.com
http://www.easyqlik.com

cesaryulgon
Contributor II
Contributor II
Author

Thank you very much for the contribution