<?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: Scripting:  How to get a Name object from a quoted string? in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/Scripting-How-to-get-a-Name-object-from-a-quoted-string/m-p/35#M35</link>
    <description>I figured out something that works:&lt;BR /&gt;&lt;BR /&gt;-----------------------------Script Start-----------------------------&lt;BR /&gt;Clear Globals();&lt;BR /&gt;Clear Log();&lt;BR /&gt;&lt;BR /&gt;MyParse = Function(&lt;BR /&gt;    {sName}, {Default Local},&lt;BR /&gt;&lt;BR /&gt;    ex = "Name(xxx)";&lt;BR /&gt;    newStr = "\!"" || sName || "\!"";&lt;BR /&gt;&lt;BR /&gt;    retVal = Munger(ex, 0, "xxx", newStr);&lt;BR /&gt;    retVal = Parse(retVal);&lt;BR /&gt;);&lt;BR /&gt;&lt;BR /&gt;str = "Width (mm)";&lt;BR /&gt;name = MyParse(str);&lt;BR /&gt;show(name);&lt;BR /&gt;-----------------------------Script End-----------------------------&lt;BR /&gt;&lt;BR /&gt;Obviously this is restricted to parsing those strings that are names.  Thanks for the help!</description>
    <pubDate>Fri, 30 Jan 2009 17:45:57 GMT</pubDate>
    <dc:creator />
    <dc:date>2009-01-30T17:45:57Z</dc:date>
    <item>
      <title>Scripting:  How to get a Name object from a quoted string?</title>
      <link>https://community.jmp.com/t5/Discussions/Scripting-How-to-get-a-Name-object-from-a-quoted-string/m-p/32#M32</link>
      <description>Assume I have the name of a table variable as a quoted string in a run-time variable.  How do I get the table variable Name object from that?&lt;BR /&gt;&lt;BR /&gt;I had this same issue with table columns which I was able to work around by getting a list of table Column Names and iterating through them until I found a Name object that matched the string.  Unfortunately there doesn't appear to be a function that returns table variables so this method doesn't work.&lt;BR /&gt;&lt;BR /&gt;Background:&lt;BR /&gt;The purpose of this is to have a reusable library that can embed formulas in columns.  Since the reuse code doesn't know the Table Variable Names or Column Names, I need to pass them to my functions as string parameters.  However, if I use the string variable when building the formula the result is a quoted string instead of a reference to the column or table variable.</description>
      <pubDate>Thu, 29 Jan 2009 19:25:48 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Scripting-How-to-get-a-Name-object-from-a-quoted-string/m-p/32#M32</guid>
      <dc:creator />
      <dc:date>2009-01-29T19:25:48Z</dc:date>
    </item>
    <item>
      <title>Re: Scripting:  How to get a Name object from a quoted string?</title>
      <link>https://community.jmp.com/t5/Discussions/Scripting-How-to-get-a-Name-object-from-a-quoted-string/m-p/33#M33</link>
      <description>You can get the table variable's value from the string with &lt;BR /&gt;&lt;BR /&gt;   x = Current Data Table() &amp;lt;&amp;lt; Get Table Variable( "teacher" );&lt;BR /&gt;&lt;BR /&gt;And you can get a column's value with&lt;BR /&gt;&lt;BR /&gt;  x = column("height")[ 1 ];&lt;BR /&gt;&lt;BR /&gt;Expressions can be used for more complicated meta-programming (JSL that manipulates JSL), but since you're starting with a string it may be better to use Parse() and Eval(). For example, the following takes a function name string and treats it as a function name.&lt;BR /&gt;&lt;BR /&gt;   s = "sqrt";  x = Eval( Parse( s || "(2)" ));</description>
      <pubDate>Fri, 30 Jan 2009 15:09:50 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Scripting-How-to-get-a-Name-object-from-a-quoted-string/m-p/33#M33</guid>
      <dc:creator>XanGregg</dc:creator>
      <dc:date>2009-01-30T15:09:50Z</dc:date>
    </item>
    <item>
      <title>Re: Scripting:  How to get a Name object from a quoted string?</title>
      <link>https://community.jmp.com/t5/Discussions/Scripting-How-to-get-a-Name-object-from-a-quoted-string/m-p/34#M34</link>
      <description>Parse() is the command I needed.  If only I had known about it a week ago!  :)&lt;/img&gt;&lt;BR /&gt;&lt;BR /&gt;Thanks!&lt;BR /&gt;&lt;BR /&gt;EDIT: I spoke a bit too soon.  Parse() won't work if the table variable name contains parentheses.  (For example, "Width (mm)")  I'll have to think about this a bit more...&lt;BR /&gt;&lt;BR /&gt;    &lt;BR /&gt;Message was edited by: DaveS</description>
      <pubDate>Fri, 30 Jan 2009 16:14:21 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Scripting-How-to-get-a-Name-object-from-a-quoted-string/m-p/34#M34</guid>
      <dc:creator />
      <dc:date>2009-01-30T16:14:21Z</dc:date>
    </item>
    <item>
      <title>Re: Scripting:  How to get a Name object from a quoted string?</title>
      <link>https://community.jmp.com/t5/Discussions/Scripting-How-to-get-a-Name-object-from-a-quoted-string/m-p/35#M35</link>
      <description>I figured out something that works:&lt;BR /&gt;&lt;BR /&gt;-----------------------------Script Start-----------------------------&lt;BR /&gt;Clear Globals();&lt;BR /&gt;Clear Log();&lt;BR /&gt;&lt;BR /&gt;MyParse = Function(&lt;BR /&gt;    {sName}, {Default Local},&lt;BR /&gt;&lt;BR /&gt;    ex = "Name(xxx)";&lt;BR /&gt;    newStr = "\!"" || sName || "\!"";&lt;BR /&gt;&lt;BR /&gt;    retVal = Munger(ex, 0, "xxx", newStr);&lt;BR /&gt;    retVal = Parse(retVal);&lt;BR /&gt;);&lt;BR /&gt;&lt;BR /&gt;str = "Width (mm)";&lt;BR /&gt;name = MyParse(str);&lt;BR /&gt;show(name);&lt;BR /&gt;-----------------------------Script End-----------------------------&lt;BR /&gt;&lt;BR /&gt;Obviously this is restricted to parsing those strings that are names.  Thanks for the help!</description>
      <pubDate>Fri, 30 Jan 2009 17:45:57 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Scripting-How-to-get-a-Name-object-from-a-quoted-string/m-p/35#M35</guid>
      <dc:creator />
      <dc:date>2009-01-30T17:45:57Z</dc:date>
    </item>
    <item>
      <title>Re: Scripting:  How to get a Name object from a quoted string?</title>
      <link>https://community.jmp.com/t5/Discussions/Scripting-How-to-get-a-Name-object-from-a-quoted-string/m-p/36#M36</link>
      <description>Thanks for sharing your results. I just realized there's also a JSL function called As Name() that converts a string to a name.</description>
      <pubDate>Fri, 30 Jan 2009 18:28:41 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Scripting-How-to-get-a-Name-object-from-a-quoted-string/m-p/36#M36</guid>
      <dc:creator>XanGregg</dc:creator>
      <dc:date>2009-01-30T18:28:41Z</dc:date>
    </item>
    <item>
      <title>Re: Scripting:  How to get a Name object from a quoted string?</title>
      <link>https://community.jmp.com/t5/Discussions/Scripting-How-to-get-a-Name-object-from-a-quoted-string/m-p/37#M37</link>
      <description>I have a .doc file that contains Column names that needs to be used to create a Oneway graph. I load the document and try to parse the string to use in the expression :&lt;BR /&gt;&lt;BR /&gt;----Script Code----&lt;BR /&gt;headers = load text file("headers.doc");&lt;BR /&gt;	heads = parse(headers);&lt;BR /&gt;&lt;BR /&gt;Oneway(	Y(: heads //This is the variable that contains the headers&lt;BR /&gt;			),&lt;BR /&gt;			X( :blah ),&lt;BR /&gt;			Means and Std Dev( 1 ),&lt;BR /&gt;			Box Plots( 1 ),&lt;BR /&gt;			Mean Lines( 1 ),&lt;BR /&gt;			Mean Diamonds( 1 ),&lt;BR /&gt;			Mean Error Bars( 1 ),&lt;BR /&gt;			Std Dev Lines( 1 ),&lt;BR /&gt;			Points Jittered( 1 ),&lt;BR /&gt;			Points Spread( 1 )&lt;BR /&gt;		)&lt;BR /&gt;	);&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;My question is, what type of string can I pass into Parse() so that I can insert multiple names into the Y() argument? Do the names need to  be semi-colon, space, carrige return, comma delimited? And can I iterate through each of the Names? Thanks.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Update: I found the Word function that takes a string and delimiter and returns a list of words. This is just waht I was looking for because I can iterate over all of the words generating Oneway graphs per word. Thanks SAS.&lt;BR /&gt;&lt;BR /&gt;Message was edited by: KaptainKodie</description>
      <pubDate>Tue, 07 Jul 2009 18:10:49 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Scripting-How-to-get-a-Name-object-from-a-quoted-string/m-p/37#M37</guid>
      <dc:creator />
      <dc:date>2009-07-07T18:10:49Z</dc:date>
    </item>
  </channel>
</rss>

