<?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: script after file import not executing in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/script-after-file-import-not-executing/m-p/390308#M64039</link>
    <description>&lt;P&gt;Craige&lt;/P&gt;&lt;P&gt;Thanks for your reply, now I made the change but the code still can't be executed as whole, PVOTC missing value is not updated, also see the same error message "invalid argument in access or evaluation of 'Column' , Column/*###*/(j)"&amp;nbsp;&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;&lt;BLOCKQUOTE&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;&lt;/CODE&gt;&lt;CODE class=" language-jsl"&gt;dtImpt = Multiple File Import(
			&amp;lt;&amp;lt;Set Folder(subLoadPath),
			&amp;lt;&amp;lt;Set Name Filter( "*.csv2*.*;" ),
			&amp;lt;&amp;lt;Set Name Enable( 1 ),
			&amp;lt;&amp;lt;Set Size Filter( {2930760, 2974144} ),
			&amp;lt;&amp;lt;Set Size Enable( 0 ),
			&amp;lt;&amp;lt;Set Date Filter( {3697799737.307, 3697800543.878} ),
			&amp;lt;&amp;lt;Set Date Enable( 0 ),
			&amp;lt;&amp;lt;Set Add File Name Column( 1 ),
			&amp;lt;&amp;lt;Set Add File Size Column( 0 ),
			&amp;lt;&amp;lt;Set Add File Date Column( 0 ),
			&amp;lt;&amp;lt;Set Import Mode( "CSVData" ),
			&amp;lt;&amp;lt;Set Charset( "Best Guess" ),
			&amp;lt;&amp;lt;Set Stack Mode( "Stack Similar" ),
			&amp;lt;&amp;lt;Set CSV Has Headers( 1 ),
			&amp;lt;&amp;lt;Set CSV Allow Numeric( 1 ),
			&amp;lt;&amp;lt;Set CSV First Header Line( 1 ),
			&amp;lt;&amp;lt;Set CSV Number Of Header Lines( 1 ),
			&amp;lt;&amp;lt;Set CSV First Data Line( 2 ),
			&amp;lt;&amp;lt;Set CSV EOF Comma( 1 ),
			&amp;lt;&amp;lt;Set CSV EOF Tab( 0 ),
			&amp;lt;&amp;lt;Set CSV EOF Space( 0 ),
			&amp;lt;&amp;lt;Set CSV EOF Spaces( 0 ),
			&amp;lt;&amp;lt;Set CSV EOF Other( "" ),
			&amp;lt;&amp;lt;Set CSV EOL CRLF( 1 ),
			&amp;lt;&amp;lt;Set CSV EOL CR( 1 ),
			&amp;lt;&amp;lt;Set CSV EOL LF( 1 ),
			&amp;lt;&amp;lt;Set CSV EOL Semicolon( 0 ),
			&amp;lt;&amp;lt;Set CSV EOL Other( "" ),
			&amp;lt;&amp;lt;Set CSV Quote( "\!"" ),
			&amp;lt;&amp;lt;Set CSV Escape( "" )
		) &amp;lt;&amp;lt; Import Data;
		dt = dtImpt[1];
		dt &amp;lt;&amp;lt; Set Name (tableName);
		
		//if PVOTC has missing value, assign 1 	
		dt &amp;lt;&amp;lt; Begin Data Update;
			For Each Row( :PVOTC = Match( :PVOTC, ., 1, :PVOTC ) );
			dt &amp;lt;&amp;lt; End Data Update;

		//delete column with no value
		For( j = N Col( dt ), j &amp;gt;= 1, j--,
			   If( (Col N Missing( Column( j ) ) / N Row()) == 1,
					  dt &amp;lt;&amp;lt; delete columns( j )
			   )
		);
		dt &amp;lt;&amp;lt; Clear Column Selection();	&lt;/CODE&gt;&amp;nbsp;&lt;/PRE&gt;&lt;/BLOCKQUOTE&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 03 Jun 2021 20:23:56 GMT</pubDate>
    <dc:creator>r30363</dc:creator>
    <dc:date>2021-06-03T20:23:56Z</dc:date>
    <item>
      <title>script after file import not executing</title>
      <link>https://community.jmp.com/t5/Discussions/script-after-file-import-not-executing/m-p/390169#M64033</link>
      <description>&lt;P&gt;hi, I am importing bunch of files from a directory and stacked them into one big file(45 files), after import into one big file, the script will clean up the dataset, add columns and rows etc. the problem I encountered is that the script will error out if being executed together as a whole piece; if I run the import first, wait for the files to load into jmp, and then run the 2nd portion of the code, it will work. I had wait(150) in between which is more than enough time to import the data, but it still does not work.&amp;nbsp; the error message says " invalid argument in access or evaluation of "Column" Column/*###/(j). I did notice the script immediate after import for PVOTC update is not executed neither. Below is my code, your help is greatly appreciated.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;files = Files In Directory( loadPath);
For( i = 1, i &amp;lt;= N Items( files ), i++, //previous steps non drb or already parsed)
	subLoadPath = loadPath ||files[i];
	stepID = num(word(2,word(-1,subLoadPath,"/" ),"_"));
	If( Is directory(subLoadPath) &amp;amp; stepID &amp;gt;= 11, // 11 is the step started to parse
 		tableName = word(-1,subLoadPath,"/" );
		tableName_flow = word(-2,subLoadPath,"/" );

		dt = Multiple File Import(
			&amp;lt;&amp;lt;Set Folder(subLoadPath),
			&amp;lt;&amp;lt;Set Name Filter( "*.csv2*.*;" ),
			&amp;lt;&amp;lt;Set Name Enable( 1 ),
			&amp;lt;&amp;lt;Set Size Filter( {2930760, 2974144} ),
			&amp;lt;&amp;lt;Set Size Enable( 0 ),
			&amp;lt;&amp;lt;Set Date Filter( {3697799737.307, 3697800543.878} ),
			&amp;lt;&amp;lt;Set Date Enable( 0 ),
			&amp;lt;&amp;lt;Set Add File Name Column( 1 ),
			&amp;lt;&amp;lt;Set Add File Size Column( 0 ),
			&amp;lt;&amp;lt;Set Add File Date Column( 0 ),
			&amp;lt;&amp;lt;Set Import Mode( "CSVData" ),
			&amp;lt;&amp;lt;Set Charset( "Best Guess" ),
			&amp;lt;&amp;lt;Set Stack Mode( "Stack Similar" ),
			&amp;lt;&amp;lt;Set CSV Has Headers( 1 ),
			&amp;lt;&amp;lt;Set CSV Allow Numeric( 1 ),
			&amp;lt;&amp;lt;Set CSV First Header Line( 1 ),
			&amp;lt;&amp;lt;Set CSV Number Of Header Lines( 1 ),
			&amp;lt;&amp;lt;Set CSV First Data Line( 2 ),
			&amp;lt;&amp;lt;Set CSV EOF Comma( 1 ),
			&amp;lt;&amp;lt;Set CSV EOF Tab( 0 ),
			&amp;lt;&amp;lt;Set CSV EOF Space( 0 ),
			&amp;lt;&amp;lt;Set CSV EOF Spaces( 0 ),
			&amp;lt;&amp;lt;Set CSV EOF Other( "" ),
			&amp;lt;&amp;lt;Set CSV EOL CRLF( 1 ),
			&amp;lt;&amp;lt;Set CSV EOL CR( 1 ),
			&amp;lt;&amp;lt;Set CSV EOL LF( 1 ),
			&amp;lt;&amp;lt;Set CSV EOL Semicolon( 0 ),
			&amp;lt;&amp;lt;Set CSV EOL Other( "" ),
			&amp;lt;&amp;lt;Set CSV Quote( "\!"" ),
			&amp;lt;&amp;lt;Set CSV Escape( "" )
		) &amp;lt;&amp;lt; Import Data;
		Wait(150);
		dt &amp;lt;&amp;lt; Set Name (tableName);
		Wait(3);

		dt = Current data table();
		Wait(3);
		dt &amp;lt;&amp;lt; Begin Data Update;
			For Each Row( :PVOTC = Match( :PVOTC, ., 1, :PVOTC ) );
			dt &amp;lt;&amp;lt; End Data Update;
		Wait(5);


		//dt = Current data table();
		For( j = N Col( dt ), j &amp;gt;= 1, j--,
			   If( (Col N Missing( Column( j ) ) / N Row()) == 1,
					  dt &amp;lt;&amp;lt; delete columns( j )
			   )
		);
		Wait(5); 
		dt &amp;lt;&amp;lt; Clear Column Selection();	&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 09 Jun 2023 19:48:28 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/script-after-file-import-not-executing/m-p/390169#M64033</guid>
      <dc:creator>r30363</dc:creator>
      <dc:date>2023-06-09T19:48:28Z</dc:date>
    </item>
    <item>
      <title>Re: script after file import not executing</title>
      <link>https://community.jmp.com/t5/Discussions/script-after-file-import-not-executing/m-p/390303#M64038</link>
      <description>&lt;P&gt;After&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;dt = Multiple File Import(...) &amp;lt;&amp;lt; Import Data;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;dt holds a list of data tables, even if only one table is imported.&lt;/P&gt;&lt;P&gt;You don't need the wait(150).&lt;/P&gt;&lt;P&gt;dt[1] will be the current data table if only one table was imported.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;edit: don't use current data table() if you can avoid it. Use an explicit handle like dt[1] if possible. Current Data Table is a JSL function that tries to behave like JMP, before JSL was invented, where the last table touched would be the table used by the next platform.&lt;/P&gt;</description>
      <pubDate>Thu, 03 Jun 2021 19:27:05 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/script-after-file-import-not-executing/m-p/390303#M64038</guid>
      <dc:creator>Craige_Hales</dc:creator>
      <dc:date>2021-06-03T19:27:05Z</dc:date>
    </item>
    <item>
      <title>Re: script after file import not executing</title>
      <link>https://community.jmp.com/t5/Discussions/script-after-file-import-not-executing/m-p/390308#M64039</link>
      <description>&lt;P&gt;Craige&lt;/P&gt;&lt;P&gt;Thanks for your reply, now I made the change but the code still can't be executed as whole, PVOTC missing value is not updated, also see the same error message "invalid argument in access or evaluation of 'Column' , Column/*###*/(j)"&amp;nbsp;&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;&lt;BLOCKQUOTE&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;&lt;/CODE&gt;&lt;CODE class=" language-jsl"&gt;dtImpt = Multiple File Import(
			&amp;lt;&amp;lt;Set Folder(subLoadPath),
			&amp;lt;&amp;lt;Set Name Filter( "*.csv2*.*;" ),
			&amp;lt;&amp;lt;Set Name Enable( 1 ),
			&amp;lt;&amp;lt;Set Size Filter( {2930760, 2974144} ),
			&amp;lt;&amp;lt;Set Size Enable( 0 ),
			&amp;lt;&amp;lt;Set Date Filter( {3697799737.307, 3697800543.878} ),
			&amp;lt;&amp;lt;Set Date Enable( 0 ),
			&amp;lt;&amp;lt;Set Add File Name Column( 1 ),
			&amp;lt;&amp;lt;Set Add File Size Column( 0 ),
			&amp;lt;&amp;lt;Set Add File Date Column( 0 ),
			&amp;lt;&amp;lt;Set Import Mode( "CSVData" ),
			&amp;lt;&amp;lt;Set Charset( "Best Guess" ),
			&amp;lt;&amp;lt;Set Stack Mode( "Stack Similar" ),
			&amp;lt;&amp;lt;Set CSV Has Headers( 1 ),
			&amp;lt;&amp;lt;Set CSV Allow Numeric( 1 ),
			&amp;lt;&amp;lt;Set CSV First Header Line( 1 ),
			&amp;lt;&amp;lt;Set CSV Number Of Header Lines( 1 ),
			&amp;lt;&amp;lt;Set CSV First Data Line( 2 ),
			&amp;lt;&amp;lt;Set CSV EOF Comma( 1 ),
			&amp;lt;&amp;lt;Set CSV EOF Tab( 0 ),
			&amp;lt;&amp;lt;Set CSV EOF Space( 0 ),
			&amp;lt;&amp;lt;Set CSV EOF Spaces( 0 ),
			&amp;lt;&amp;lt;Set CSV EOF Other( "" ),
			&amp;lt;&amp;lt;Set CSV EOL CRLF( 1 ),
			&amp;lt;&amp;lt;Set CSV EOL CR( 1 ),
			&amp;lt;&amp;lt;Set CSV EOL LF( 1 ),
			&amp;lt;&amp;lt;Set CSV EOL Semicolon( 0 ),
			&amp;lt;&amp;lt;Set CSV EOL Other( "" ),
			&amp;lt;&amp;lt;Set CSV Quote( "\!"" ),
			&amp;lt;&amp;lt;Set CSV Escape( "" )
		) &amp;lt;&amp;lt; Import Data;
		dt = dtImpt[1];
		dt &amp;lt;&amp;lt; Set Name (tableName);
		
		//if PVOTC has missing value, assign 1 	
		dt &amp;lt;&amp;lt; Begin Data Update;
			For Each Row( :PVOTC = Match( :PVOTC, ., 1, :PVOTC ) );
			dt &amp;lt;&amp;lt; End Data Update;

		//delete column with no value
		For( j = N Col( dt ), j &amp;gt;= 1, j--,
			   If( (Col N Missing( Column( j ) ) / N Row()) == 1,
					  dt &amp;lt;&amp;lt; delete columns( j )
			   )
		);
		dt &amp;lt;&amp;lt; Clear Column Selection();	&lt;/CODE&gt;&amp;nbsp;&lt;/PRE&gt;&lt;/BLOCKQUOTE&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 03 Jun 2021 20:23:56 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/script-after-file-import-not-executing/m-p/390308#M64039</guid>
      <dc:creator>r30363</dc:creator>
      <dc:date>2021-06-03T20:23:56Z</dc:date>
    </item>
    <item>
      <title>Re: script after file import not executing</title>
      <link>https://community.jmp.com/t5/Discussions/script-after-file-import-not-executing/m-p/390320#M64042</link>
      <description>&lt;P&gt;Probably more than one table open, try being explicit, like this&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;If( (Col N Missing( Column(dt, j ) ) / N Row()) == 1&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;I think the column function is using a different table (actually, the current table) than the one you expect. Adding the dt to the column function tells it which table, otherwise it is the current table (which may not have caught up when you run it in one go.)&lt;/P&gt;</description>
      <pubDate>Thu, 03 Jun 2021 21:56:24 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/script-after-file-import-not-executing/m-p/390320#M64042</guid>
      <dc:creator>Craige_Hales</dc:creator>
      <dc:date>2021-06-03T21:56:24Z</dc:date>
    </item>
  </channel>
</rss>

