Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

QlikView Fans! We’d love to hear from you.
Share your QlikView feedback with the product team… Click here to participate in our 5-minute survey.
Rules, plus terms and conditions, can be found here.
New Contributor II

VBScript module with if else


I have the below VBscript module that with a button inserts the values that the variables of input boxes are given by the user into an oracle table.

sub insert_oracle

set myStoreval = ActiveDocument.Variables("STOREVAL")

insStore = myStoreval.GetContent.String

set myItemval = ActiveDocument.Variables("ITEMVAL")

insItem = myItemval.GetContent.String

set myPriceval = ActiveDocument.Variables("PRICEVAL")

insPrice = myPriceval.GetContent.String

set dbinsval = CreateObject("ADODB.Connection")

dbinsval.open "DSN=xxx;UID=xxx;PWD=xxx"

set insertvalfile = dbinsval.execute("INSERT INTO QLIKVIEW (STORE, ITEMKEY, PRICEKEY) VALUES (' " & insStore & " ', ' " & insItem & " ', ' " & insPrice & " ') ;")

set insertvalfile = dbinsval.execute("COMMIT;")


myStoreval.SetContent " ",true

myItemval.SetContent " ",true

myPriceval.SetContent " ",true

end sub

How can i tell if the variables are empty send a message "You must fill all the input boxes" else if the user has fill all the input boxes send another message with option "You have to insert Values into the table Are you sure ?  Yes or No."

With No to exit from the Sub and with Yes to execute the insert.

Can anyone help me to create this code ?

Thank you in advance.

1 Reply
Honored Contributor

Re: VBScript module with if else

Hi, i give you and example:

reloadPrompt=MsgBox("Confirm report",4,"Confirm Generation")

if reloadPrompt = vbYes then

call LoadingVisible


end sub

another thing to do to controle the text that the user digit is:

if(len(variable) = 0) then



exit sub

Good luck


Community Browser