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

Announcements
Want to see what's currently in public preview? We've pulled it all together in one place. Check it out here
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Input data from a button click

Hi!

Is possible input data into a qvd or excel, for example, from a button click?

I need to count how many users clicked in to a button. Maybe a action/macro?

Thanks!

Labels (1)
1 Solution

Accepted Solutions
Not applicable
Author

I did it using a macro. Thanks for the help.

sub logdet

dim oConn, rs, UserID, Datetime, v1, v2

'on error resume next
'err.clear

Set oConn = CreateObject("ADODB.Connection")

oConn.Open "provider=sqloledb.1;data source=server;initial catalog=db; User ID=user; Password=password"

set v1 = ActiveDocument.Variables("vUserID")
UserID = v1.GetContent.String

set  v2 = ActiveDocument.Variables("vDatetime")
Datetime = v2.GetContent.String

oConn.Execute "INSERT INTO DW.dbo.LOGDET(USUARIO, DATA_ACESSO) VALUES ('"&UserID&"', '"&Datetime&"')"

oConn.Close

'If Err.Number <> 0 Then
'
' msgbox("ERRO: " & Err.Number)
' msgbox("USERID: " & UserID)
' msgbox("DATETIME: " & Datetime)
'
'
'Else
'
' msgbox("All rows are now stored in database")'End message
'
'End if

end sub

View solution in original post

4 Replies
psankepalli
Partner - Creator III
Partner - Creator III

can you explain in detail..

satishkurra
Specialist II
Specialist II

If i understand you correctly , you want to insert/update data into qvd file using a button action.

This is not possible. You need to write a macro for doing this

satishkurra
Specialist II
Specialist II

Also check if the below link can help you ...

Loading Data into Input Boxes

Not applicable
Author

I did it using a macro. Thanks for the help.

sub logdet

dim oConn, rs, UserID, Datetime, v1, v2

'on error resume next
'err.clear

Set oConn = CreateObject("ADODB.Connection")

oConn.Open "provider=sqloledb.1;data source=server;initial catalog=db; User ID=user; Password=password"

set v1 = ActiveDocument.Variables("vUserID")
UserID = v1.GetContent.String

set  v2 = ActiveDocument.Variables("vDatetime")
Datetime = v2.GetContent.String

oConn.Execute "INSERT INTO DW.dbo.LOGDET(USUARIO, DATA_ACESSO) VALUES ('"&UserID&"', '"&Datetime&"')"

oConn.Close

'If Err.Number <> 0 Then
'
' msgbox("ERRO: " & Err.Number)
' msgbox("USERID: " & UserID)
' msgbox("DATETIME: " & Datetime)
'
'
'Else
'
' msgbox("All rows are now stored in database")'End message
'
'End if

end sub