Skip to main content
Announcements
Qlik Introduces a New Era of Visualization! READ ALL ABOUT IT
cancel
Showing results for 
Search instead for 
Did you mean: 
Frédéricdh
Creator
Creator

Using an Input Box for Script

Hello,

 

I'm using an InputBox to use the variable in the script, but the variable in the Input Box is defined with an function expression as 'Num(GetFieldSelections(X))' and then in the script Qlik use the text of the function and not the value of the function.

 

What must I do, to have only a value

Labels (1)
16 Replies
F_B
Creator III
Creator III

Frédéricdh
Creator
Creator
Author

Yes I use Let but I doesn't work

vuan
Partner - Contributor II
Partner - Contributor II

Do you still have the let in your script? Be sure to remove this line from your script.

marcus_sommer

You need any logic which stored the evaluated result as a fix value - maybe with any macro which assigned the value to another variable or which exports it in a text-file or Excel.

Frédéricdh
Creator
Creator
Author

Hello, can you give me a link: how to create a macro and how to export in a text file?

 

thank you

marcus_sommer

You may use a table-chart without any dimension and just your variable-calculation as expression and then a statement like:

sub x
   set obj = ActiveDocument.GetSheetObject("CH21")
   obj.ExportEx "D:\test.txt", 1
end sub

to export it as txt or by using 5 or 6 as parameter as xls/xlsx.

A good source for such stuff is the APIGuide.qvw within your QV install-folder (by automation).

PhanThanhSon
Creator
Creator

Hi,

I believe if you have a variable vTest = Num(GetFieldSelections(X)), you either need an equals sign at the beginning of your expression or you have to handle your call like this: $(=vTest).

 

Best regards Son

Frédéricdh
Creator
Creator
Author

Hello PhanThanhSon,

no your solution doesn't work, I have a variable like vTest = GetFieldSelections and in the script I use $(=vTest), but when I load the script, Qlik doesn't find a value for the variable.

 

I find a solution for that and I need to use a Button and define a set variable with this button.

 

Best Regards

 

Frédéric S.

marcus_sommer

You will always need an external storing because the variables calculation-result exists only within the UI. As far as the reload is performed the UI is gone and it exists only the scripted parts which is by the variable just the value respectively the calculation-string.