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

Variable in vbscript

Hi,

I am hoping someone can provide some “how to” info on using variables in a vbscript. Below is the script we using to call data from an API. We want to now be able to get data from a List Box. Any help on the coding would be much appreciated.

Thanks,

Terry.

sub GetLists()

Dim xml

Dim strXML

strXML = "<?xml version=""1.0"" encoding=""UTF-8""?>"

strXML = strXML & "<Envelope>"

strXML = strXML & "<Body>"

strXML = strXML & "<Login>"

strXML = strXML & "<USERNAME>username</USERNAME>"

strXML = strXML & "<PASSWORD>password</PASSWORD>"

strXML = strXML & "</Login>"

strXML = strXML & "<GetLists>"

strXML = strXML & "<VISIBILITY>0</VISIBILITY>"

strXML = strXML & "<LIST_TYPE>2</LIST_TYPE>"

strXML = strXML & "</GetLists>"

strXML = strXML & "</Body>"

strXML = strXML & "</Envelope>"

set xml = CreateObject("Microsoft.XMLHTTP") 'XMLHTTP is an MS object that handles xml post over http

' msgbox strXML

xml.Open "POST", "http://api.somedomain.com/XMLAPI?xml="&strXML, False

xml.Send

Path = ActiveDocument.Evaluate("left(DocumentPath(), index(DocumentPath(), '\', -1))")   

    FileName = Path & "GetLists.xml"

     set fso = CreateObject("Scripting.FileSystemObject")

        set s = fso.CreateTextFile(FileName, True)

        s.writeline(xml.responseText)

        s.Close()

msgbox ("Done")

end sub

username.jpg

2 Replies
m_woolf
Master II
Master II

This is from the API Guide:

set table = ActiveDocument.GetSheetObject( "LB01" )

CellRect = ActiveDocument.GetApplication().GetEmptyRect()

CellRect.Top = 0

CellRect.Left = 0

CellRect.Width = table.GetColumnCount

CellRect.Height = table.GetRowCount

set CellMatrix = table.GetCells( CellRect )

for RowIter=CellRect.Top to CellRect.Height-1

    for ColIter=CellRect.Left to CellRect.Width-1

        msgbox(CellMatrix(RowIter)(ColIter).Text)

    next

next

Not applicable
Author

In your macro, try this

ActiveDocument.Fields("yourfieldname").GetSelectedValues.Item(0).Text

This assumes you want the first selected item.

ws