cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
  • Don’t miss your chance to experience Discovery Summit Europe at our best available rate! Early bird registration through 31 Oct.
  • Graph Builder Toolbar streamlines interactive graphing. Creates shortcuts on Report and GraphBuilder Helpers toolbars. Download and install the extension.
  • JMP will suspend normal business operations for our Rest and Recharge Day on Friday, October 2, 2026.
    Regular business hours will resume on Monday, October 5, 2026.

Discussions

Solve problems, and share tips and tricks with other JMP users.
Choose Language Hide Translation Bar
uday_guntupalli
Level VIII

How to replace double quotes in string

All, 

    This seems to be fairly simple but extremely frustrating task . How do I replace quotation marks in a string . 

    Let us say , I have the following columns ( Inv 01 , Inv 02 ... Inv 26) . 

    So, I acquired the column names and built a condition like so : 

 

Stmt = "";
for(i = 1, i <= N Items(InvColNames), i++,
        If(i == 1,
               Stmt = ":" || InvColNames[i] || " >= 1 &" || ":" || InvColNames[i] || " <= InvLimit" ;
	       ,
               Stmt = Stmt || " & " || ":" || InvColNames[i] || ">= 1 &" || ":" || InvColNames[i] || " <= InvLimit"  ; 
          ) ;
    );
":Inv 01 >= 1 &:Inv 01 <= InvLimit & :Inv 02>= 1 &:Inv 02 <= InvLimit & :Inv 03>= 1 &:Inv 03 <= InvLimit" 
Stmt = Substitute(Stmt, "\!"", ""); 
InvStatusExpr = Expr(dt_Inp << New Column("Status_Inv",Numeric,Continuous,Formula(Expr(Stmt))));
Eval(Eval Expr(InvStatusExpr));

I wish to them use the condition I built as an expression and define a condition . The problem though is in its current form , since the "Stmt" I built is enveloped in double quotes, it is being evaluated as a string and the statement I built is being populated into the new column. 

 

If someone can show me a simple way to replace double quotes in a string and get this to work , I would appreciate the help . 

 

 

6-19-2017 3-41-33 PM.png

 

 

Best 

Uday 

 

 

 

 

 

Best
Uday
1 ACCEPTED SOLUTION

Accepted Solutions

Re: How to replace double quotes in string

Eval( Parse( Eval Insert( will get you out of trouble when you are really stuck but should be a last resort as the code is hard to debug.

 

Basically you are inserting your string as text into the desired JSL and than evaluating the JSL. The ^^ tells the Insert Command where to work.

 

Eval( Parse( Eval Insert("\[ dt_Inp << New Column("Status_Inv",Numeric,Continuous,Formula(^Stmt^)); ]\" ) ) );

This is called dynamic JSL which can be very powerful.

View solution in original post

1 REPLY 1

Re: How to replace double quotes in string

Eval( Parse( Eval Insert( will get you out of trouble when you are really stuck but should be a last resort as the code is hard to debug.

 

Basically you are inserting your string as text into the desired JSL and than evaluating the JSL. The ^^ tells the Insert Command where to work.

 

Eval( Parse( Eval Insert("\[ dt_Inp << New Column("Status_Inv",Numeric,Continuous,Formula(^Stmt^)); ]\" ) ) );

This is called dynamic JSL which can be very powerful.

Recommended Articles