cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Submit your abstract to the call for content for Discovery Summit Americas by April 23. Selected abstracts will be presented at Discovery Summit, Oct. 21- 24.
Choose Language Hide Translation Bar
dilipkumar
Level II

passing variable with doble quoate ""

Hi All,

i have written a script  in jsl where i have defined a variable and passing it through my logic. Since my defined variable contains  double quote " ", jsl is throwing an error ,it says unexpected "2", perhaps there is missing ";" or ",". I am very new to jsl. can anyone help me in that.

1 ACCEPTED SOLUTION

Accepted Solutions
txnelson
Super User

Re: passing variable with doble quoate ""

To embedd a double quote (") in a string you will need to use the JSL escape character string to indicate to JSL how to parse the character.  The JSL escape character pattern is \!

SLNo = " ABC1\!"2'";
Jim

View solution in original post

3 REPLIES 3
txnelson
Super User

Re: passing variable with doble quoate ""

You need to use the :Name() function to precisely specify columns with special characters in them

Names Default To Here( 1 );

New Table( "Example",
	Add Rows( 10 ),
	New Column( "test\!" of quote",
		Numeric,
		"Continuous",
		Format( "Best", 12 ),
		Set Values( [40, 26, 27, 36, 39, 19, 25, 9, 7, 30] )
	)
);

Distribution(
	Continuous Distribution( Column( :Name( "test\!" of quote" ) ) )
);
Jim
dilipkumar
Level II

Re: passing variable with doble quoate ""

Hi,

Thanks for replying.

i think you didnot get my question right.

Actually i have defined a input variable ( say x=abc) which i am trying to pass through a logic where for the same variable i will be getting data extracted from SQL database. Problem i am  facing  is, if i am changing the input to double quoted value , jsl is throwing this error -jsl is throwing an error ,it says unexpected "2", perhaps there is missing ";" or ","

 

Please find the example on the same

//Create Database Connection
dbc = Create Database Connection(
       XXX);

SLNo = " ABC1"2'";

sqlQuery = "execute [dbo].[XXX] @SLNo = '" || SLNo || "'";

Error msg : jsl is throwing an error ,it says unexpected "2", perhaps there is missing ";" or ","

Question is what shouild i do if SLNo data is in double Quote format. it is working fine without double quoted inputs.

txnelson
Super User

Re: passing variable with doble quoate ""

To embedd a double quote (") in a string you will need to use the JSL escape character string to indicate to JSL how to parse the character.  The JSL escape character pattern is \!

SLNo = " ABC1\!"2'";
Jim