<?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 Problem to format numeric data from Txt file in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/Problem-to-format-numeric-data-from-Txt-file/m-p/398367#M64937</link>
    <description>&lt;P&gt;Dear Community,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am trying to build a jsl script to properly import data formatted as in the ecnlosed example file. I am facing to challenges:&lt;/P&gt;&lt;P&gt;- The decimal sign is "," instead of ".". By using the default setup of my regional preferences, JMP interprets the "," as a thousand delimiter. How to force JMP properly interpret these number within a jsl script?&lt;/P&gt;&lt;P&gt;- the negative numbers are formatted as follows:&amp;nbsp;64,000-. Can JMP handle such format.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;One solution could be to re-format the txt file, but it is an extract from the ERP and the IT team does not understand that I don't manage to handle such file wheras Excel does.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks and regards,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Jérôme&lt;/P&gt;</description>
    <pubDate>Fri, 09 Jun 2023 19:51:41 GMT</pubDate>
    <dc:creator>J_Bonnouvrier1</dc:creator>
    <dc:date>2023-06-09T19:51:41Z</dc:date>
    <item>
      <title>Problem to format numeric data from Txt file</title>
      <link>https://community.jmp.com/t5/Discussions/Problem-to-format-numeric-data-from-Txt-file/m-p/398367#M64937</link>
      <description>&lt;P&gt;Dear Community,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am trying to build a jsl script to properly import data formatted as in the ecnlosed example file. I am facing to challenges:&lt;/P&gt;&lt;P&gt;- The decimal sign is "," instead of ".". By using the default setup of my regional preferences, JMP interprets the "," as a thousand delimiter. How to force JMP properly interpret these number within a jsl script?&lt;/P&gt;&lt;P&gt;- the negative numbers are formatted as follows:&amp;nbsp;64,000-. Can JMP handle such format.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;One solution could be to re-format the txt file, but it is an extract from the ERP and the IT team does not understand that I don't manage to handle such file wheras Excel does.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks and regards,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Jérôme&lt;/P&gt;</description>
      <pubDate>Fri, 09 Jun 2023 19:51:41 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Problem-to-format-numeric-data-from-Txt-file/m-p/398367#M64937</guid>
      <dc:creator>J_Bonnouvrier1</dc:creator>
      <dc:date>2023-06-09T19:51:41Z</dc:date>
    </item>
    <item>
      <title>Re: Problem to format numeric data from Txt file</title>
      <link>https://community.jmp.com/t5/Discussions/Problem-to-format-numeric-data-from-Txt-file/m-p/398548#M64955</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;You might try something like the following; while you mention that IT does not understand your problem, you can use JSL to reformat the file yourself. While there is likely an import setting to handle the commas-as-decimals, I cannot think of it offhand and cannot find it in the documentation. Perhaps someone else will reply with that setting. Until then, see if this does the trick. I've attached a sample file; if you place it in your Downloads folder the script will hopefully run without modifications.&lt;/P&gt;
&lt;P&gt;&lt;CODE class=" language-jsl"&gt;&lt;/CODE&gt;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here( 1 );

//set these to reflect your path and file name

path = "$DOWNLOADS/";
origFile = "example.txt";
holdFile = "example_modified.txt";

//get text of original file and replace commas with decimals
txt = Substitute( Load Text File( path || origFile ), ",", "." );

//save resulting text to a file, open this file as a table, then delete the file
Save Text File( path || holdFile, txt );
dt = Open( path || holdFile );
Delete File( path || holdFile );

//create a new column. if the last character is not "-", the string is immediately converted to a number. If the last
//character IS a "-", the string is converted to a number after the "-" is moved to the first character of the string
dt &amp;lt;&amp;lt; New Column( "xx", formula( Num( If( Right( :INFO, 1 ) != "-", :INFO, "-" || Left( :INFO, Length( :INFO ) - 1 ) ) ) ) );

//remove the formula, so we can delete the original INFO column and rename our new column to INFO
dt:xx &amp;lt;&amp;lt; Delete Formula;
dt &amp;lt;&amp;lt; Delete Columns( "INFO" );
dt:xx &amp;lt;&amp;lt; set name( "INFO" );


&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;CODE class=" language-jsl"&gt;

&lt;/CODE&gt;&lt;/P&gt;
&lt;P&gt;Cheers,&lt;/P&gt;
&lt;P&gt;Brady&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>Tue, 06 Jul 2021 14:33:22 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Problem-to-format-numeric-data-from-Txt-file/m-p/398548#M64955</guid>
      <dc:creator>brady_brady</dc:creator>
      <dc:date>2021-07-06T14:33:22Z</dc:date>
    </item>
    <item>
      <title>Re: Problem to format numeric data from Txt file</title>
      <link>https://community.jmp.com/t5/Discussions/Problem-to-format-numeric-data-from-Txt-file/m-p/399784#M65080</link>
      <description>&lt;P&gt;I love this smart solution, I didn't know this way to modify txt files directly. Thank you very much!&lt;/P&gt;</description>
      <pubDate>Fri, 09 Jul 2021 11:39:10 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Problem-to-format-numeric-data-from-Txt-file/m-p/399784#M65080</guid>
      <dc:creator>J_Bonnouvrier1</dc:creator>
      <dc:date>2021-07-09T11:39:10Z</dc:date>
    </item>
  </channel>
</rss>

