<?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 Not a Name Error when after selecting file path for saving PNG in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/Not-a-Name-Error-when-after-selecting-file-path-for-saving-PNG/m-p/778579#M96013</link>
    <description>&lt;P&gt;Hi, I am trying to modify my code so that the user can selected which file path to save the result PNG files as well as naming the PNG files. The code is a subscript that will be called by the main script. My problem is that after I select the path and name the PNG file, I get a "Not a Name" error, the PNG file will be saved to the path I selected but the naming won't go through. How can I fix this?&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;MyGraph = Function({yCol},
    {default local},
    vars = Eval Expr(Variables(
        X(:Test Stage),
        Group X(:Lot)
    ));

    pts = Expr(Box Plot(X));

    For(j = 1, j &amp;lt;= Min(8, N Items(yCol)), j++,
        Insert Into(vars, Eval Expr(Y(Expr(yCol[j]), Position(1))));
    );

    gb = Expr(
        Graph Builder(
            Size(1255, 981),
            Show Control Panel(0),
            Elements(Box Plot(X, Y(1), Y(2), Y(3), Y(4), Y(5), Y(6), Y(7), Y(8))),
            Local Data Filter(
                Add Filter(
                    columns(:Test Stage, :Sublot, :Temperature, :Soft Bin, :Serial Id),
                    Display(:Test Stage, N Items(4)),
                    Display(:Soft Bin, N Items(15))
                )
            )
        )
    );
    Insert Into(gb, Name Expr(vars));

    // Prompt the user to select a directory to save the PNG
    dir_path = Pick Directory("Select Directory to Save PNG");

    // Check if the user selected a directory
    If(Is Empty(dir_path) == 0,
        // Ask for the file name using New Window
        nw = New Window("Save File", &amp;lt;&amp;lt;Modal,
            VListBox(
                Text Box("Enter filename:"),
                file_name_box = Text Edit Box("box_FT1vsFT2")
            ),
            Button Box("OK", Dialog(0))
        );

        // Extract the file name from the text edit box
        file_name = Char(Eval(file_name_box));  // Convert to string explicitly

        // Construct the full path
        png_path = dir_path || "/" || file_name || ".png";

        // Save the picture
        gb &amp;lt;&amp;lt; Save Picture(png_path, "png");
    ,
        Caption("Save operation was canceled.")
    );
);

dt = Current Data Table();

New Window("My report",
    VListBox(
        MyGraph(::yColName)
    )
);&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Fri, 02 Aug 2024 20:49:57 GMT</pubDate>
    <dc:creator>ARETI052</dc:creator>
    <dc:date>2024-08-02T20:49:57Z</dc:date>
    <item>
      <title>Not a Name Error when after selecting file path for saving PNG</title>
      <link>https://community.jmp.com/t5/Discussions/Not-a-Name-Error-when-after-selecting-file-path-for-saving-PNG/m-p/778579#M96013</link>
      <description>&lt;P&gt;Hi, I am trying to modify my code so that the user can selected which file path to save the result PNG files as well as naming the PNG files. The code is a subscript that will be called by the main script. My problem is that after I select the path and name the PNG file, I get a "Not a Name" error, the PNG file will be saved to the path I selected but the naming won't go through. How can I fix this?&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;MyGraph = Function({yCol},
    {default local},
    vars = Eval Expr(Variables(
        X(:Test Stage),
        Group X(:Lot)
    ));

    pts = Expr(Box Plot(X));

    For(j = 1, j &amp;lt;= Min(8, N Items(yCol)), j++,
        Insert Into(vars, Eval Expr(Y(Expr(yCol[j]), Position(1))));
    );

    gb = Expr(
        Graph Builder(
            Size(1255, 981),
            Show Control Panel(0),
            Elements(Box Plot(X, Y(1), Y(2), Y(3), Y(4), Y(5), Y(6), Y(7), Y(8))),
            Local Data Filter(
                Add Filter(
                    columns(:Test Stage, :Sublot, :Temperature, :Soft Bin, :Serial Id),
                    Display(:Test Stage, N Items(4)),
                    Display(:Soft Bin, N Items(15))
                )
            )
        )
    );
    Insert Into(gb, Name Expr(vars));

    // Prompt the user to select a directory to save the PNG
    dir_path = Pick Directory("Select Directory to Save PNG");

    // Check if the user selected a directory
    If(Is Empty(dir_path) == 0,
        // Ask for the file name using New Window
        nw = New Window("Save File", &amp;lt;&amp;lt;Modal,
            VListBox(
                Text Box("Enter filename:"),
                file_name_box = Text Edit Box("box_FT1vsFT2")
            ),
            Button Box("OK", Dialog(0))
        );

        // Extract the file name from the text edit box
        file_name = Char(Eval(file_name_box));  // Convert to string explicitly

        // Construct the full path
        png_path = dir_path || "/" || file_name || ".png";

        // Save the picture
        gb &amp;lt;&amp;lt; Save Picture(png_path, "png");
    ,
        Caption("Save operation was canceled.")
    );
);

dt = Current Data Table();

New Window("My report",
    VListBox(
        MyGraph(::yColName)
    )
);&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 02 Aug 2024 20:49:57 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Not-a-Name-Error-when-after-selecting-file-path-for-saving-PNG/m-p/778579#M96013</guid>
      <dc:creator>ARETI052</dc:creator>
      <dc:date>2024-08-02T20:49:57Z</dc:date>
    </item>
    <item>
      <title>Re: Not a Name Error when after selecting file path for saving PNG</title>
      <link>https://community.jmp.com/t5/Discussions/Not-a-Name-Error-when-after-selecting-file-path-for-saving-PNG/m-p/778592#M96015</link>
      <description>&lt;P&gt;Have you verified that file_name contains what you think it does? You most likely want to either use &amp;lt;&amp;lt; return results or get the value from text edit box using &amp;lt;&amp;lt; get text when OK is pressed.&lt;/P&gt;</description>
      <pubDate>Fri, 02 Aug 2024 21:17:29 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Not-a-Name-Error-when-after-selecting-file-path-for-saving-PNG/m-p/778592#M96015</guid>
      <dc:creator>jthi</dc:creator>
      <dc:date>2024-08-02T21:17:29Z</dc:date>
    </item>
  </channel>
</rss>

