Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

VBscript - how to create a Generic list of type string

I need to create an Generic list of type String, that I want to fill with some values.

I tried the following statements

Dim sList
Set sList = CreateObject(“System.Collections.Generic.List[String]”)
sList.Add(“Read”)
sList.Add(“Stop”)

This is not working.

Can you please provide me with the correct code?

15 Replies
marcus_sommer

What is your aim in the end? How should this string-list look like, from where should it be filled and what should be done with these list?

- Marcus

Not applicable
Author

The code must be working when attached to a button in a QVW document that runs on the Qlikview accespoint with the AJAX engine.

marcus_sommer

On this point is your macro-approach already out then within the ajax-client run no macros and especially not one which include a CreateObject() which required the use of ActiveX which is only within the desktop-client or the plugin available.

Therefore the question what do you want to do with these routine?

- Marcus

Not applicable
Author

Marcus,

I would like to trigger the Function TriggerEDXTask with all parameters.

I've everything in place to trigger this function, except that I cannot define/create the variableValues As List(Of String)

Function TriggerEDXTask ( _

qdsID As Guid, _

taskNameOrID As String, _

password As String, _

variableName As String, _

variableValues As List(Of String) _

) As TriggerEDXTaskResult

So if I know how to fill the variableValues on a correct manner, it would be great.

marcus_sommer

Are you sure that this is a vbs-example and that edx worked per vbs-macros?

- Marcus

Not applicable
Author

The function as mentioned above is not a VB script example. It is just a copy out of the documentation of the API function, and there you can read that the value for the last parameter (variableValues) should be a generic list of type string.

So that's why I need to know how I can populate such a type of list.

marcus_sommer

For this you could use concat() within the gui in a variable which you could read with a macro or within a macro it could be created with an evaluate() statement.

- Marcus

Not applicable
Author

Hi Marcus,

thanks for the tips and help sofar, but unfortunately I still don't know exactly what to do. (I'm rater a newbee in VBscript)

I have done the following in the variable definitions

vCall1 = Read (via input box)

vCall2 = Copy (via input box)

vConcat = concat('$(vCall1)', '$(vCall2)')    (via Variable definition)

When I put the variable vConcat in a text box (='$(vConcat)')) nothing is shown.

In the macro I try to read the variable vConcat with the following command

y = ActiveDocument.Variables("vConcat").getcontent.string

I have my doubts about the .string at the end of this read, but I don't know what to put else there.

The result is that y = empty

So what do I do wrong in this coding?

How can I use the evaluate() option in the Macro?

marcus_sommer

Concat() is a string aggregation-function which you didn't need if you want only to concat strings from variables which you could concat with: '$(vCall1)' & ',' & '$(vCall2)'.


To execute qlik-functions from the macro-side you could use the following:


x = ActiveDocument.Evaluate("Concat(YourField, ',')")


whereby you could simply read your variables vCall1 + vCall2.


- Marcus