Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

VBScript with Straight Table

Hello All,

Is it possible to load a Straight Table cell value into a variable?

Thanks!



5 Replies
Miguel_Angel_Baeyens

Hello and welcome to the Forums,

Rather, you can set the expression you used in the straight table into a variable or in a text object. Say you have a chart showing Country as dimension and Sum(Sales) as expression. If it's one particular value of the dimension what you want to show, create a variable with something like

Sum({< Country = {'ES'} >} Sales)


Hope that helps.

Miguel_Angel_Baeyens

Sorry,

You mean using macros? Then this should work:

Sub GetCell Set st = ActiveDocument.GetSheetObject("CHXX") '' ID of the straight table stc = st.GetCell(1, 2) '' First row second columnEnd Sub


Hope that helps.

Not applicable
Author

Thanks Miguel!

That's what I'm looking for.

And how can I use the 'stc' value outside the Edit Module and include it in an Expression in a TextBox for instance?

I'm a newbie 🙂



Miguel_Angel_Baeyens

Hi,

Glad to help. Try with this

Sub GetCellAndSetText Set st = ActiveDocument.GetSheetObject("CHXX") '' ID of the straight table stc = st.GetCell(1, 2) '' First row second column (including subtotal, if any) Set t = ActiveDocument.GetSheetObject("TXXX") '' ID of the text object t.SetText stc.TextEnd Sub


Hope that helps.

Not applicable
Author

Thanks a lot Miguel!