<?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: Check if a folder exists in a JMP Live space in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/Check-if-a-folder-exists-in-a-JMP-Live-space/m-p/805280#M98345</link>
    <description>&lt;P&gt;I'm not familiar with JMP Live, but have you tried increasing the page size for the query (or utilized Next() call)? Scripting Index can have some examples which you cannot find from JMP Help page&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="jthi_0-1728879393089.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/69073i278FBFCF0452940D/image-size/medium?v=v2&amp;amp;px=400" role="button" title="jthi_0-1728879393089.png" alt="jthi_0-1728879393089.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 14 Oct 2024 04:17:38 GMT</pubDate>
    <dc:creator>jthi</dc:creator>
    <dc:date>2024-10-14T04:17:38Z</dc:date>
    <item>
      <title>Check if a folder exists in a JMP Live space</title>
      <link>https://community.jmp.com/t5/Discussions/Check-if-a-folder-exists-in-a-JMP-Live-space/m-p/805247#M98341</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Using JSL in JMP18 I can create new folders in both my personal space and in other spaces on JMP Live using the '&lt;FONT face="courier new,courier"&gt;Create Folder&lt;/FONT&gt;' function.&amp;nbsp;When I create folders in my personal space, I can use the JSL '&lt;FONT face="courier new,courier"&gt;Find Folders&lt;/FONT&gt;' function to list all existing folders first and check if my new folder already exists. I could then assure unique folder names trough JSL.&lt;/P&gt;&lt;P&gt;The default behavior of JMP Live is to create unique folder names by adding "&lt;FONT face="courier new,courier"&gt; (n)&lt;/FONT&gt;" to the folder name with '&lt;FONT face="courier new,courier"&gt;n&lt;/FONT&gt;' being the count of the number of folders with the same name. But I would like to avoid this.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In other JMP Live spaces, not my personal space, I observe the same behavior: identical folder names are automatically appended by "&lt;FONT face="courier new,courier"&gt; (n)&lt;/FONT&gt;". However, the&amp;nbsp;'&lt;FONT face="courier new,courier"&gt;Find Folders&lt;/FONT&gt;' function does not have the Space Key as a parameter so I cannot check for already existing folders on spaces that are not my personal space.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I find that the only function that accepts the space key as a parameter is the '&lt;FONT face="courier new,courier"&gt;Create Folder&lt;/FONT&gt;' function. I checked the relevant JSL help page &lt;A href="https://www.jmp.com/support/help/en/18.0/#page/jmp/publish-reports-or-data-to-jmp-live.shtml" target="_self"&gt;here&lt;/A&gt;, but this situation is not described.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;What is the recommended approach to extract existing folders on a JMP Live space? or am I missing the obvious here?&lt;BR /&gt;&lt;BR /&gt;Thanks!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Paul&lt;/P&gt;</description>
      <pubDate>Sun, 13 Oct 2024 23:25:32 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Check-if-a-folder-exists-in-a-JMP-Live-space/m-p/805247#M98341</guid>
      <dc:creator>paul_vanoppen</dc:creator>
      <dc:date>2024-10-13T23:25:32Z</dc:date>
    </item>
    <item>
      <title>Re: Check if a folder exists in a JMP Live space</title>
      <link>https://community.jmp.com/t5/Discussions/Check-if-a-folder-exists-in-a-JMP-Live-space/m-p/805280#M98345</link>
      <description>&lt;P&gt;I'm not familiar with JMP Live, but have you tried increasing the page size for the query (or utilized Next() call)? Scripting Index can have some examples which you cannot find from JMP Help page&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="jthi_0-1728879393089.png" style="width: 400px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/69073i278FBFCF0452940D/image-size/medium?v=v2&amp;amp;px=400" role="button" title="jthi_0-1728879393089.png" alt="jthi_0-1728879393089.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 14 Oct 2024 04:17:38 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Check-if-a-folder-exists-in-a-JMP-Live-space/m-p/805280#M98345</guid>
      <dc:creator>jthi</dc:creator>
      <dc:date>2024-10-14T04:17:38Z</dc:date>
    </item>
    <item>
      <title>Re: Check if a folder exists in a JMP Live space</title>
      <link>https://community.jmp.com/t5/Discussions/Check-if-a-folder-exists-in-a-JMP-Live-space/m-p/805281#M98346</link>
      <description>&lt;P&gt;Thanks Jarmo,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;No, I did not try this yet. here is my code that works well for checking for existing folders in a personal space.&lt;BR /&gt;There is no code included that assures a unique folder name (for simplicity's sake) but that could easily be created.&lt;BR /&gt;As I stated in my post: it appears that &lt;FONT face="courier new,courier"&gt;Find Folders&lt;/FONT&gt; function does not have a space key and by default runs the query in my personal JMP Live space.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;I am guessing that the PageSize parameter in &lt;FONT face="courier new,courier"&gt;FindFolders&lt;/FONT&gt; can be used to page through a long list of folders (should they exist).&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;// open the connection to JMP Live
	liveConnection = New JMP Live( Connection(  ) );

	// get the user name from JMP Live
	user = liveConnection &amp;lt;&amp;lt; Get Username;

	// get the existing folders already in my Space
	getFolders = liveConnection &amp;lt;&amp;lt; Find Folders( Publisher( user ) );
	folderlist = getFolders &amp;lt;&amp;lt; As Scriptable();

	// Define the folder name you want to check or create
	folderName = "new_folder_name"; 
	// Define the space key of the Space you wish to create the folder in 
	spaceKey = "~"; // set key to "~" for your personal space or use the space key

	// Initialize a variable to store the folder ID
	folderID = .;

	// Check if the folder exists. If it exists, folderID will contain the ID
	// if the folder does not exist, folderID will contain a missing value
	For( i = 1, i &amp;lt;= folderlist &amp;lt;&amp;lt; Get Number Of Items, i += 1,
		If( folderlist[i] &amp;lt;&amp;lt; Get Title == folderName,
			folderID = folderlist[i] &amp;lt;&amp;lt; Get ID;
			Show( folderID );
			Break();
		)
	);

	// If the folder does not exist, create it. folderID will contain the folder ID.
	If( Is Missing( folderID ),
		newFolder = liveConnection &amp;lt;&amp;lt; Create Folder(
			Space( spaceKey ), // Use "~" for personal space or specify the space key
			Title( folderName ),
			Description( "Automatically created folder." )
		);
		folderID = newFolder &amp;lt;&amp;lt; As Scriptable;
		folderID = folderID &amp;lt;&amp;lt; Get ID;
	);&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 14 Oct 2024 05:02:15 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Check-if-a-folder-exists-in-a-JMP-Live-space/m-p/805281#M98346</guid>
      <dc:creator>paul_vanoppen</dc:creator>
      <dc:date>2024-10-14T05:02:15Z</dc:date>
    </item>
    <item>
      <title>Re: Check if a folder exists in a JMP Live space</title>
      <link>https://community.jmp.com/t5/Discussions/Check-if-a-folder-exists-in-a-JMP-Live-space/m-p/805282#M98347</link>
      <description>&lt;P&gt;One more comment, if I run the &lt;FONT face="courier new,courier"&gt;Find Folders&lt;/FONT&gt; function and I manually inspect the returned list, I can see that there is a list entry for each folder in my personal space. There are no other entries (while I have access to other spaces with folders).&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;Paul&lt;/P&gt;</description>
      <pubDate>Mon, 14 Oct 2024 05:29:34 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Check-if-a-folder-exists-in-a-JMP-Live-space/m-p/805282#M98347</guid>
      <dc:creator>paul_vanoppen</dc:creator>
      <dc:date>2024-10-14T05:29:34Z</dc:date>
    </item>
    <item>
      <title>Re: Check if a folder exists in a JMP Live space</title>
      <link>https://community.jmp.com/t5/Discussions/Check-if-a-folder-exists-in-a-JMP-Live-space/m-p/805283#M98348</link>
      <description>&lt;P&gt;Did you try dropping this part from the Find Folders&lt;/P&gt;
&lt;PRE class="language-jsl"&gt;&lt;CODE&gt;Publisher( user ) &lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 14 Oct 2024 05:35:43 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Check-if-a-folder-exists-in-a-JMP-Live-space/m-p/805283#M98348</guid>
      <dc:creator>jthi</dc:creator>
      <dc:date>2024-10-14T05:35:43Z</dc:date>
    </item>
    <item>
      <title>Re: Check if a folder exists in a JMP Live space</title>
      <link>https://community.jmp.com/t5/Discussions/Check-if-a-folder-exists-in-a-JMP-Live-space/m-p/805521#M98381</link>
      <description>&lt;P&gt;Hi Jarmo,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for the suggestion. It turns out to be the winner!&lt;BR /&gt;This code (adding the &lt;FONT face="courier new,courier"&gt;Search&lt;/FONT&gt; function as a parameter to the &lt;FONT face="courier new,courier"&gt;Find Folders&lt;/FONT&gt; function):&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;// open the connection to JMP Live
liveConnection = OpenJMPLiveConnection( );

foldername = "foldername";

// get the existing folders already in my Space
getFolders = liveConnection &amp;lt;&amp;lt; Find Folders( Search( foldername ) );
folderlist = getFolders &amp;lt;&amp;lt; As Scriptable();

Show(folderlist);&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;returns the name, description, ID and URL of the folder if it exists outside my personal space.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Paul&lt;/P&gt;</description>
      <pubDate>Tue, 15 Oct 2024 04:46:19 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Check-if-a-folder-exists-in-a-JMP-Live-space/m-p/805521#M98381</guid>
      <dc:creator>paul_vanoppen</dc:creator>
      <dc:date>2024-10-15T04:46:19Z</dc:date>
    </item>
  </channel>
</rss>

