Hi Can any one tell me how to escape comma (,) from a string. I know it for double quate (") it is \! but not aware for comma(,)
Hi @dilipkumar,
No escape character needed for a comma, you can simply use them inside your quoted string:
For reference, I've included the jsl escape sequences at the bottom of this post. But, are you encountering a situation where a comma in a string appears to cause some kind of error? I'm sure we can get to the bottom of what's happening if you can elaborate.
@jules
Without seeing more of your script I can't say why JMP is processing that variable in that manner. Actually, I would expect the entire string to always be returned unless you are doing extra work to take it apart based on the delimiter. Are you using a function such as Word() to peel away pieces of the string X? If you can share more I'm happy to help figure this out. Alternatively, if you wish to pass a single variable around, but want tighter control over what you reference in the variable, perhaps a list. From your description, it sounds like you want one element to be "abc" and another element "x,yz." The following jsl could help with that :
x = {"abc", "k,yz"}; print( x[1] ); //"abc" print( x[2] ); //k,yz"
Here are some uses of passing a variable x="abc,k,yz"; in JSL, none of which cause an error. Can you be more specific on where you are seeing an issue? I can see it being a problem if it is being added to another literal string without quoting arond it.
names default to here(1); x= "abc,k,yz"; rr=function({y},show(y)); rr(x); dt=new table(new column(x,formula(random uniform()))); dt<<add rows(10); Distribution( Continuous Distribution( Column( as column(x) ) ) );
Actually I need to fetch data from data base, based on the variable defined below(MN). If I am passing the MN in my jsl script and getting data of 3C22, Y MERS,.AAA-.75YIN . as a output
//Create Database Connection dbc = Create Database Connection( "XXX", ) MN = "3C22,Y MERS,.AAA-.75YIN";// where 3C22 is one input and 2nd input is Y MERS,.AAA-.75YIN" dataTable = New Table( "RAW DATA"); ddt = Data Table( 1 ); //Execute SQL statements using this connection sqlQuery = "execute [dbo].[ABC] @MN = '" || MN|| "'";
Regards,Dilip