Skip to main content
Announcements
July 15, NEW Customer Portal: Initial launch will improve how you submit Support Cases. IMPORTANT DETAILS
cancel
Showing results for 
Search instead for 
Did you mean: 
jsingh71
Partner - Specialist
Partner - Specialist

How I assign macro variable value into qlikview variable???

I created two qlikview variables 'vName' and 'vAvlName'.

through macro I am getting the value from qlikview variable 'vName'.

Sub DispName
set Name1 = ActiveDocument.Variables("vName")
GetUserName = vName.GetContent.String
End Sub

Now in 'GetUserName' variable i got the value.

Now I want to assign this value to qlikview variable 'vAvlName'.

How can I assign this value from macro to qlikview variable.

Please help.........

1 Solution

Accepted Solutions
azimabadi
Creator III
Creator III

Sub DispName

          set Name1 = ActiveDocument.Variables("vName")

          set Name2 = ActiveDocument.Variables("vAvlName")

          GetUserName = Name1.GetContent.String

          GetOldUserName = Trim(Name2.GetContent.String)

          if ( GetOldUserName <> "" ) then

                         tmpString = GetOldUserName & "," & GetUserName

          else

                         tmpString = GetUserName

          end if

          Name2.SetContent tmpString , true

End Sub

View solution in original post

18 Replies
azimabadi
Creator III
Creator III

Hi Amit,

It is as simple as following :

Sub DispName

          set Name1 = ActiveDocument.Variables("vName")

          set Name2 = ActiveDocument.Variables("vAvlName")

          GetUserName = Name1.GetContent.String

          Name2.SetContent GetUserName , true

End Sub

Best regards - Peyman

azimabadi
Creator III
Creator III

please notice that vName is not correct and you need to use Name1 instead.

GetUserName = vName.GetContent.String


jsingh71
Partner - Specialist
Partner - Specialist
Author

Thanx for your reply.

but this was not a correct answer which i am looking.

Actually I have 'vName' qlikview variable and one more 'vAvlName' qlikview variable.

I am getting vName value through Macro and want to assign this value into qlikview variable 'vAvlName'.

devans_1
Creator
Creator

Try:

GetUserName = ActiveDocument.Variables("vName").GetContent.String

ActiveDocument.Variables("vAvName").SetContent GetUserName, True

David

azimabadi
Creator III
Creator III

That is exactly what this macro do. Please use my code in your madule and test it yourself. I'll post an example QVW asap.

Best regards - Peyman

azimabadi
Creator III
Creator III

hier is the example.

devans_1
Creator
Creator

Yes, it is basically the same as what you wrote Peyman. I think it should work. I have used similar code on many occasions and never had a problem.

jsingh71
Partner - Specialist
Partner - Specialist
Author

Thank you very much Peyman and David.

Please refer VARs.qvw

one last thing I want to know then I mark this disscussion as Answered.

Suppose first I enter name 'Qlik' and clik on button then 'Qlik' will display in text object.

Now I enter 'View' and when I click on button then I want Qlik, View as displayed in Text box.

How I concatenate previous word into new word??

devans_1
Creator
Creator

Try:

GetUserName = ActiveDocument.Variables("vName").GetContent.String

CurrUserName = ActiveDocument.Variables("vAvName").GetContent.String

NewUserName = GetUserName & "," & CurrUserName

ActiveDocument.Variables("vAvName").SetContent NewUserName, True