Qlik Community

QlikView App Development

Discussion Board for collaboration related to QlikView App Development.

Announcements
Leverage your QlikView investment to modernize BI – see how! Join Group
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Not applicable

Insert into Sql table using Macro

Hi All

Need your help please.I am trying to update a Field in Qlikview table using a Variable and then i am Trying to write that variable value in a SQL table so that can use that value to populate the Table on reload: I am using below Macro. I am getting an Error message when i try to Insert Variable value into Table (Highlighted Red) [Object doesn't support this property or method: 'val2.Item' ]

This syntax works fine when i use a value without a variable but using variable throws error message:

Probably code needs a bit of tweaking val2.Item(i).Text .

Sub QV2SQL
SET Connection= GetAgentConnection()
dim uSQL
dim RegAfectados
dim importe
Dim Ibox1
RegAfectados = 0

set val=ActiveDocument.Fields("ID").GetPossibleValues
set val2 = ActiveDocument.Variables("vValue")
Ibox1=val2.GetContent.String


for i=0 to val.Count-1
Connection.Execute "INSERT INTO [dbo].[DQ_Challenges_Validated_Data] ([Pk_ID],[Feedback_ID]) VALUES ('" & val.Item(i).Text & "', '" &  val2.Item(i).Text & "')"
next

End Sub

Tags (1)
1 Solution

Accepted Solutions
Highlighted
Master II
Master II

Re: Insert into Sql table using Macro

From the APIGuide:

set v = ActiveDocument.Variables("Variable1")

msgbox(v.GetContent.String)

View solution in original post

1 Reply
Highlighted
Master II
Master II

Re: Insert into Sql table using Macro

From the APIGuide:

set v = ActiveDocument.Variables("Variable1")

msgbox(v.GetContent.String)

View solution in original post