- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
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 .
Best
Uday
Uday
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
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.