Skip to main content
Announcements
Introducing a new Enhanced File Management feature in Qlik Cloud! GET THE DETAILS!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Add apostrophe symbol in an input box

Hey i have created an input box and every time i add an apostrophe symbol in it, the macro window pops up. How can i add an apostrophe symbol ( ' ) in an input box?

18 Replies
Not applicable
Author

I have not assigned any trigger (OnChange or OnInput) to the variable which is storing the value of the input box

Not applicable
Author

sub Cannotdecide_Rationale_SQLInsert

Const adOpenStatic = -1  ''these first two two lines have to be there when you are trying to insert into an external database

Const adLockOptimistic = -1

set Var_test = ActiveDocument.GetVariable("v_QVWB_CantDecide").getcontent

set Var_Row = ActiveDocument.GetVariable("v_ClaimID").getcontent

Set Var_Date = ActiveDocument.GetVariable("v_ModelRunDate").getcontent

Set objConnection = CreateObject("ADODB.Connection")

objConnection.Open "dsn=NEWDMNZ1D;User ID=********;Password=********"

Set objRecordSet = CreateObject("ADODB.Recordset")

var = Var_test.string

dom ="'" 

row=Var_Row.string

Mdate=Var_Date.string 

 

objRecordSet.Open "UPDATE NEWDMNZ1D.ADMIN.GHCMO_LCP_RESULTS_SET SET RATIONAL_FOR_DECISION_TXT = "& dom & var & dom &_

"Where (CLM_NUM_CD= '"  & row & "' and MODEL_PROCESS_DT =  '" & Mdate & "')" , _

objConnection, adOpenStatic, adLockOptimistic

end sub

tamilarasu
Champion
Champion

Change the below lines in your macro and try again. I replaced the variables with double apostrophe.

set Var_test = ActiveDocument.GetVariable("v_QVWB_CantDecide").getcontent

set Var_Row = ActiveDocument.GetVariable("v_ClaimID").getcontent

Set Var_Date = ActiveDocument.GetVariable("v_ModelRunDate").getcontent


set Var_test = Replace(ActiveDocument.GetVariable("v_QVWB_CantDecide").getcontent ,"'","''")

set Var_Row = Replace(ActiveDocument.GetVariable("v_ClaimID").getcontent ,"'","''")

Set Var_Date = Replace(ActiveDocument.GetVariable("v_ModelRunDate").getcontent ,"'","''")

Not applicable
Author

hi,

i tried this but it is throwing an error since when i replace " ' " with " " ", the QlikView is reading the first two double quotes and reading the last double quote as incomplete (" " ")

Not applicable
Author

Can you also tell me what happens if i have a OnChange or an OnInput trigger on the variable. Could this be a possible reason for input field not accepting a single apostrophe sign, please?

hemanthaanichet
Creator III
Creator III

Hi Vikas,

Try this:

set Var_test = Replace(ActiveDocument.GetVariable("v_QVWB_CantDecide").getcontent ," CHR(39) "," " ")

set Var_Row = Replace(ActiveDocument.GetVariable("v_ClaimID").getcontent ," CHR(39) "," " ")

Set Var_Date = Replace(ActiveDocument.GetVariable("v_ModelRunDate").getcontent ," CHR(39) "," " ")

Not applicable
Author

hi Hemanth,

I tried this out also but the " " " at the last is incomplete, and this is what which is giving error

hemanthaanichet
Creator III
Creator III

Hi Vikas,

use single codes instead of double codes at the end

set Var_test = Replace(ActiveDocument.GetVariable("v_QVWB_CantDecide").getcontent ,' CHR(39) ',' " ')

set Var_Row = Replace(ActiveDocument.GetVariable("v_ClaimID").getcontent ,' CHR(39) ',' " ')

Set Var_Date = Replace(ActiveDocument.GetVariable("v_ModelRunDate").getcontent ,' CHR(39) ',' " ')

Regards

Hemanth

rubenmarin

Hi Vikas, I was about to answer something similar to what Jonathan saids...

When a macro throws an error QV opens the macro editor, this is what is happening to you so it seems that the apostrophe is creating an error in a macro.

Maybe when the macro uses the variable the apostrophe is breaking the code (probably it comments the code after the apostrophe comes to the macro)

If you have an OnChange or OnInput wich launches a macro (or updates another field or variable that launches the macro) the error will be thrown as soon as you change the variable value.