BookmarkSubscribeRSS Feed
Choose Language Hide Translation Bar
dilipkumar
Occasional Contributor

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.

0 Kudos
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
3 REPLIES 3
Highlighted
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
Occasional Contributor

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.

0 Kudos
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