<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Set MAp Role via script in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/Set-MAp-Role-via-script/m-p/247401#M48557</link>
    <description>&lt;P&gt;Ok it looks like I found a solution to this :&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;dt= open (pick file (), invisible ) ;

path = dt&amp;lt;&amp;lt; get path;

 

dt&amp;lt;&amp;lt;close ;

show (path);&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;This seems to solve it :)&lt;/img&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 13 Feb 2020 11:04:24 GMT</pubDate>
    <dc:creator>bobmorrane</dc:creator>
    <dc:date>2020-02-13T11:04:24Z</dc:date>
    <item>
      <title>Set MAp Role via script</title>
      <link>https://community.jmp.com/t5/Discussions/Set-MAp-Role-via-script/m-p/247394#M48553</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am making a script to help beginners set some parameters in a data table, such as table variables and map roles.&lt;/P&gt;&lt;P&gt;The issue is when I set the map role, the file path is not recorded in the column properties&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;path = pick file ();

dt0:my_column &amp;lt;&amp;lt; set property ("Map Role", Map Role ("Shape Name Use" (path), "My_column") ) ) ;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Any ideas what causes this ?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 13 Feb 2020 10:49:32 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Set-MAp-Role-via-script/m-p/247394#M48553</guid>
      <dc:creator>bobmorrane</dc:creator>
      <dc:date>2020-02-13T10:49:32Z</dc:date>
    </item>
    <item>
      <title>Re: Set MAp Role via script</title>
      <link>https://community.jmp.com/t5/Discussions/Set-MAp-Role-via-script/m-p/247398#M48555</link>
      <description>&lt;P&gt;Ok, after fiddling with this for a while, I see where the problem lies :&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;file paths in Windows look like this&amp;nbsp; C:\user\file.txt&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;When you extract a path in jmp using pick file (), it converts it to "C:/user/file.txt". I guess this is because JMP considers '\' to be a special character. The weird thing is, in other JSL instructions, you can just use the JMP&amp;nbsp;syntax for file paths&amp;nbsp;but for some reason, Map Role uses the normal Windows syntax.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Now my question is : is there a simple way to convert a JMP file path into a Windows file path ? Something that would avoid the need to write it like this :&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;"C:\!\user\!\file.txt"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Alternatively, a script that could access the column properties directly and open the prompt t ochoose a file in the map role pane would be useful too.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Thu, 13 Feb 2020 10:59:25 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Set-MAp-Role-via-script/m-p/247398#M48555</guid>
      <dc:creator>bobmorrane</dc:creator>
      <dc:date>2020-02-13T10:59:25Z</dc:date>
    </item>
    <item>
      <title>Re: Set MAp Role via script</title>
      <link>https://community.jmp.com/t5/Discussions/Set-MAp-Role-via-script/m-p/247401#M48557</link>
      <description>&lt;P&gt;Ok it looks like I found a solution to this :&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;dt= open (pick file (), invisible ) ;

path = dt&amp;lt;&amp;lt; get path;

 

dt&amp;lt;&amp;lt;close ;

show (path);&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;This seems to solve it :)&lt;/img&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 13 Feb 2020 11:04:24 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Set-MAp-Role-via-script/m-p/247401#M48557</guid>
      <dc:creator>bobmorrane</dc:creator>
      <dc:date>2020-02-13T11:04:24Z</dc:date>
    </item>
    <item>
      <title>Re: Set MAp Role via script</title>
      <link>https://community.jmp.com/t5/Discussions/Set-MAp-Role-via-script/m-p/247411#M48559</link>
      <description>&lt;P&gt;Also, I think that the argument with the path is a named argument, not a string, so it looks like this:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;dt0:my_column &amp;lt;&amp;lt; Set Property ( "Map Role", Map Role( Shape Name Use( path ), "My_column" ) ) ) ;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;BTW, JMP uses the POSIX path format by default, not the Windows format. But usually it will automatically convert or you can explicitly call the built-in function to convert between the two formats.&lt;/P&gt;</description>
      <pubDate>Thu, 13 Feb 2020 12:13:41 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Set-MAp-Role-via-script/m-p/247411#M48559</guid>
      <dc:creator>Mark_Bailey</dc:creator>
      <dc:date>2020-02-13T12:13:41Z</dc:date>
    </item>
    <item>
      <title>Re: Set MAp Role via script</title>
      <link>https://community.jmp.com/t5/Discussions/Set-MAp-Role-via-script/m-p/247419#M48561</link>
      <description>&lt;P&gt;That route is a bit round-about and unnecessary. See this &lt;A href="https://www.jmp.com/support/help/en/15.1/#page/jmp/file-functions.shtml?os=win&amp;amp;source=application#ww4945280" target="_self"&gt;function&lt;/A&gt;.&lt;/P&gt;</description>
      <pubDate>Thu, 13 Feb 2020 12:22:54 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Set-MAp-Role-via-script/m-p/247419#M48561</guid>
      <dc:creator>Mark_Bailey</dc:creator>
      <dc:date>2020-02-13T12:22:54Z</dc:date>
    </item>
    <item>
      <title>Re: Set MAp Role via script</title>
      <link>https://community.jmp.com/t5/Discussions/Set-MAp-Role-via-script/m-p/247421#M48562</link>
      <description>&lt;P&gt;thanks &lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/5358"&gt;@Mark_Bailey&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I learnt something here. I didn't know what Posix was :)&lt;/img&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Searching for POSIX in the Scripting index, I found the conversion function :&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;path = pick file () ; 

converted_path= Convert File Path (path, windows) ; &lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Compared to using the &amp;lt;&amp;lt;get path message, this saves the opening of the table.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 13 Feb 2020 12:23:44 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Set-MAp-Role-via-script/m-p/247421#M48562</guid>
      <dc:creator>bobmorrane</dc:creator>
      <dc:date>2020-02-13T12:23:44Z</dc:date>
    </item>
    <item>
      <title>Re: Set MAp Role via script</title>
      <link>https://community.jmp.com/t5/Discussions/Set-MAp-Role-via-script/m-p/247424#M48563</link>
      <description>&lt;P&gt;So I do I manage to set this property from a text string ?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You said this is " a named argument, not a string ". What does this mean ? I guess this is a downside of JSL, the system being so simple and flexible, users don't know the exact nature of what they are manipulating&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I tried the following syntaxes&amp;nbsp;to no avail&amp;nbsp;:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;dt0:my_column &amp;lt;&amp;lt; Set Property ( "Map Role", Map Role( Shape Name Use(Eval( path) ), "My_column" ) );

dt0:my_column &amp;lt;&amp;lt; Set Property ( "Map Role", Map Role( Shape Name Use(Expr( path) ), "My_column" ) );

Eval Expr (dt0:my_column &amp;lt;&amp;lt; Set Property ( "Map Role", Map Role( Shape Name Use(Expr( path) ), "My_column" ) ) );&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 13 Feb 2020 12:47:43 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Set-MAp-Role-via-script/m-p/247424#M48563</guid>
      <dc:creator>bobmorrane</dc:creator>
      <dc:date>2020-02-13T12:47:43Z</dc:date>
    </item>
    <item>
      <title>Re: Set MAp Role via script</title>
      <link>https://community.jmp.com/t5/Discussions/Set-MAp-Role-via-script/m-p/247427#M48564</link>
      <description>&lt;P&gt;It is simple. Here are examples of different arguments.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Literal argument, numeric or character string:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;x = Sqrt( 5 );

x = Num( "5" );&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Variable argument:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;x = 5;
y = Sqrt( x );&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Named argument:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;dt &amp;lt;&amp;lt; Bivariate( Y( :weight ), X( :height ), Fit Line );&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;The last example includes named arguments (Y, X, and Fit Line) and literal arguments (:weight and :height). Your original code enclosed the Shape Name Use() named argument in character string delimiters, which made it a character string argument.&lt;/P&gt;</description>
      <pubDate>Thu, 13 Feb 2020 13:28:21 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Set-MAp-Role-via-script/m-p/247427#M48564</guid>
      <dc:creator>Mark_Bailey</dc:creator>
      <dc:date>2020-02-13T13:28:21Z</dc:date>
    </item>
    <item>
      <title>Re: Set MAp Role via script</title>
      <link>https://community.jmp.com/t5/Discussions/Set-MAp-Role-via-script/m-p/247540#M48586</link>
      <description>&lt;P&gt;Ok, finally my script works :)&lt;/img&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For some reason, when I wrote :&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;dt0:my_column &amp;lt;&amp;lt; set property ("Map Role", Map Role (Shape Name Use (path, "my_column" ) ) ;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;It wouldn't transfer the string contained in the variable path into the column&amp;nbsp;property. It still wouldn't work when I tried to use Eval(path) and other workarounds. I'm guessing JSL doesn't support evaluating variables Inside this message.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So here is the workaround I found :&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;My_expression = Eval Expr ( dt0:my_column &amp;lt;&amp;lt; set property ("Map Role", Map Role (Shape Name Use (Expr(path), "my_column" ) ) );

Eval (My_expression); &lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;And this finally does the trick!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The step to convert the path from posix to Windows was not necesary in the end, as&amp;nbsp; the column property accepts both formats.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 14 Feb 2020 10:07:22 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Set-MAp-Role-via-script/m-p/247540#M48586</guid>
      <dc:creator>bobmorrane</dc:creator>
      <dc:date>2020-02-14T10:07:22Z</dc:date>
    </item>
  </channel>
</rss>

