<?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 How do I get the import file settings right before transposing and joining two files by script? in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/How-do-I-get-the-import-file-settings-right-before-transposing/m-p/59063#M32496</link>
    <description>&lt;P&gt;I have two sources of data that I need to put together and create a master tabel for analysis and reporting.&lt;/P&gt;&lt;P&gt;One is in .csv (Resulst 1) and another is in .xlsx (Results 2) format. The file in .xlsx format I need to specify individual worksheet settings and which sheet to open when importing. I have seen the following posts but have not managed to get it to work:&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.jmp.com/t5/JMP-Scripts/Combine-multiple-txt-or-csv-files/ta-p/24083" target="_blank"&gt;https://community.jmp.com/t5/JMP-Scripts/Combine-multiple-txt-or-csv-files/ta-p/24083&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.jmp.com/t5/Discussions/How-do-I-get-the-import-file-settings-right-before-concatenating/m-p/39286#M22977" target="_blank"&gt;https://community.jmp.com/t5/Discussions/How-do-I-get-the-import-file-settings-right-before-concatenating/m-p/39286#M22977&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;On Results 1 I need to specify columns 1 to 3. On Results 2, I need to specify columns 1 to 16 and rows 6 to 7 on the Protocol sheet. Also, after importing Results 2&amp;nbsp;I will then need to transpose from column 3 until column n (n means not empty), transposing it by column 1.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I will then need to join the resulting tables together based on matching columns.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Could anyone provide a script for this or give some examples so I can work it out myself?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&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;&lt;P&gt;&amp;nbsp;&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, 01 Jun 2018 15:13:29 GMT</pubDate>
    <dc:creator>ivomdb</dc:creator>
    <dc:date>2018-06-01T15:13:29Z</dc:date>
    <item>
      <title>How do I get the import file settings right before transposing and joining two files by script?</title>
      <link>https://community.jmp.com/t5/Discussions/How-do-I-get-the-import-file-settings-right-before-transposing/m-p/59063#M32496</link>
      <description>&lt;P&gt;I have two sources of data that I need to put together and create a master tabel for analysis and reporting.&lt;/P&gt;&lt;P&gt;One is in .csv (Resulst 1) and another is in .xlsx (Results 2) format. The file in .xlsx format I need to specify individual worksheet settings and which sheet to open when importing. I have seen the following posts but have not managed to get it to work:&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.jmp.com/t5/JMP-Scripts/Combine-multiple-txt-or-csv-files/ta-p/24083" target="_blank"&gt;https://community.jmp.com/t5/JMP-Scripts/Combine-multiple-txt-or-csv-files/ta-p/24083&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.jmp.com/t5/Discussions/How-do-I-get-the-import-file-settings-right-before-concatenating/m-p/39286#M22977" target="_blank"&gt;https://community.jmp.com/t5/Discussions/How-do-I-get-the-import-file-settings-right-before-concatenating/m-p/39286#M22977&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;On Results 1 I need to specify columns 1 to 3. On Results 2, I need to specify columns 1 to 16 and rows 6 to 7 on the Protocol sheet. Also, after importing Results 2&amp;nbsp;I will then need to transpose from column 3 until column n (n means not empty), transposing it by column 1.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I will then need to join the resulting tables together based on matching columns.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Could anyone provide a script for this or give some examples so I can work it out myself?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&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;&lt;P&gt;&amp;nbsp;&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, 01 Jun 2018 15:13:29 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-do-I-get-the-import-file-settings-right-before-transposing/m-p/59063#M32496</guid>
      <dc:creator>ivomdb</dc:creator>
      <dc:date>2018-06-01T15:13:29Z</dc:date>
    </item>
    <item>
      <title>Re: How do I get the import file settings right before transposing and joining two files by script?</title>
      <link>https://community.jmp.com/t5/Discussions/How-do-I-get-the-import-file-settings-right-before-transposing/m-p/59065#M32497</link>
      <description>&lt;P&gt;I think that the best way to get started with JSL is by using script that JMP generates when you use the point-and-click interface.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Let's start with the import of Results 1. All you should need to do is open it (File &amp;gt; Open) and the resulting JMP table will have a "source" script. Right-click on this and Edit to get the script that will carry out this import. (Don't worry about the extra columns that you don't need - you can specify the ones you need when you join tables later.) Your script should look like this but with the full file path instead of "C:\...".&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Open(
	"C:\...",
	columns(
		New Column( "Sample", Character, "Nominal" ),
		New Column( "Hour", Numeric, "Continuous", Format( "Best", 12 ) ),
		New Column( "Average", Numeric, "Continuous", Format( "Best", 12 ) ),
		New Column( "Minimum", Numeric, "Continuous", Format( "Best", 12 ) ),
		New Column( "Maximum", Numeric, "Continuous", Format( "Best", 12 ) )
	),
	Import Settings(
		End Of Line( CRLF, CR, LF ),
		End Of Field( Comma, CSV( 1 ) ),
		Strip Quotes( 0 ),
		Use Apostrophe as Quotation Mark( 0 ),
		Use Regional Settings( 0 ),
		Scan Whole File( 1 ),
		Treat empty columns as numeric( 0 ),
		CompressNumericColumns( 0 ),
		CompressCharacterColumns( 0 ),
		CompressAllowListCheck( 0 ),
		Labels( 1 ),
		Column Names Start( 1 ),
		Data Starts( 2 ),
		Lines To Read( "All" ),
		Year Rule( "20xx" )
	)
)&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;For the Excel file you can use &lt;A href="https://www.jmp.com/support/help/14/import-microsoft-excel-files.shtml" target="_self"&gt;the Excel Import Wizard&lt;/A&gt;. You can specify the worksheet and the row numbers where the data starts and ends. Again, you can then get the source script from the resulting JMP table.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Open(
	"C:\...",
	Worksheets( "Protocol" ),
	Use for all sheets( 0 ),
	Concatenate Worksheets( 0 ),
	Create Concatenation Column( 0 ),
	Worksheet Settings(
		1,
		Has Column Headers( 1 ),
		Number of Rows in Headers( 2 ),
		Headers Start on Row( 1 ),
		Data Starts on Row( 9 ),
		Data Starts on Column( 1 ),
		Data Ends on Row( 10 ),
		Data Ends on Column( 0 ),
		Replicated Spanned Rows( 1 ),
		Replicated Spanned Headers( 0 ),
		Suppress Hidden Rows( 1 ),
		Suppress Hidden Columns( 1 ),
		Suppress Empty Columns( 1 ),
		Treat as Hierarchy( 0 ),
		Multiple Series Stack( 0 ),
		Import Cell Colors( 0 ),
		Limit Column Detect( 0 ),
		Column Separator String( "-" )
	)
)&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;If you put these scripts together you will have a script that imports both tables into JMP, which is a good start. One thing that you need to know is that you need to add a semi-colon, ";", at the end of each action when you have a sequence of actions in one script.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Another thing that you will need to know is that you want to create references for your data tables in your script. You might give each table a reference like dt1, dt2 ...&lt;/P&gt;
&lt;P&gt;In this next bit of script I have modified the Results1 import to give the resulting table a reference, dt1, and I have added a semi-colon at the end so that it will work when I then add the script for the next action later.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;dt1 = Open(
	"C:\...",
	columns(
		New Column( "Sample", Character, "Nominal" ),
		New Column( "Hour", Numeric, "Continuous", Format( "Best", 12 ) ),
		New Column( "Average", Numeric, "Continuous", Format( "Best", 12 ) ),
		New Column( "Minimum", Numeric, "Continuous", Format( "Best", 12 ) ),
		New Column( "Maximum", Numeric, "Continuous", Format( "Best", 12 ) )
	),
	Import Settings(
		End Of Line( CRLF, CR, LF ),
		End Of Field( Comma, CSV( 1 ) ),
		Strip Quotes( 0 ),
		Use Apostrophe as Quotation Mark( 0 ),
		Use Regional Settings( 0 ),
		Scan Whole File( 1 ),
		Treat empty columns as numeric( 0 ),
		CompressNumericColumns( 0 ),
		CompressCharacterColumns( 0 ),
		CompressAllowListCheck( 0 ),
		Labels( 1 ),
		Column Names Start( 1 ),
		Data Starts( 2 ),
		Lines To Read( "All" ),
		Year Rule( "20xx" )
	)
);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Obviously there is more to do here to get your solution but hopefully that helps as a starting point.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Phil&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 01 Jun 2018 15:52:56 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-do-I-get-the-import-file-settings-right-before-transposing/m-p/59065#M32497</guid>
      <dc:creator>Phil_Kay</dc:creator>
      <dc:date>2018-06-01T15:52:56Z</dc:date>
    </item>
  </channel>
</rss>

