BookmarkSubscribeRSS Feed
Shlomizr

Occasional Contributor

Joined:

Sep 13, 2018

Parse stop at @

Hi,

I am trying to execute below script, when I try to parse string that has @ I get below error (see log below), please advise.

 

 

dt= data table ("RECIPE");
col={"COL_RECIPE@112345@X*HELLO", "COL_RECIPE@78902@X*GET"};
If( Contains( col[1], "COL_RECIPE@112345@X*HELLO" ),
dt<< New Column ("NEW_RECIPE",
Character,
);
text="Column(\!"NEW_RECIPE\!")<< Formula(:" || col[1] || ");";
Eval(Parse(text));
);

 

 

error log:

Unexpected "@". Perhaps there is a missing "," or ")".
Trying to parse arguments of function "Formula".
Line 1 Column 43: ...E")<< Formula(:COL_RECIPE►@112345@X*HELLO);...

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
pmroz

Super User

Joined:

Jun 23, 2011

Solution

Re: Parse stop at @

JMP is getting confused because the column name contains "@" and "*".  This code will work:

dt = Open( "$sample_data\Big Class.jmp" );
col = {"COL_RECIPE@112345@X*HELLO", "COL_RECIPE@78902@X*GET"};
If( Contains( col[1], "COL_RECIPE@112345@X*HELLO" ),
	dt << New Column( "NEW_RECIPE", Character, );
	text = evalinsert("\[Column(dt, "NEW_RECIPE")<< Formula(:name("^col[1]^"));]\");
	Eval( Parse( text ) );
);
2 REPLIES
Highlighted
pmroz

Super User

Joined:

Jun 23, 2011

Solution

Re: Parse stop at @

JMP is getting confused because the column name contains "@" and "*".  This code will work:

dt = Open( "$sample_data\Big Class.jmp" );
col = {"COL_RECIPE@112345@X*HELLO", "COL_RECIPE@78902@X*GET"};
If( Contains( col[1], "COL_RECIPE@112345@X*HELLO" ),
	dt << New Column( "NEW_RECIPE", Character, );
	text = evalinsert("\[Column(dt, "NEW_RECIPE")<< Formula(:name("^col[1]^"));]\");
	Eval( Parse( text ) );
);
Shlomizr

Occasional Contributor

Joined:

Sep 13, 2018

Re: Parse stop at @

Thanks for your great support, work perfect.