<?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 Bad Argument( Scriptable[] ) in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/Bad-Argument-Scriptable/m-p/801984#M97794</link>
    <description>&lt;P&gt;Hello&amp;nbsp;everyone,&lt;BR /&gt;&lt;BR /&gt;I have a problem with my script, i want to do a study :&lt;BR /&gt;It's about filtering the IDs, avoiding IDs that are empty, equal to "-" or equal to "NOK". Then, these filtered IDs should be placed in a new table called &lt;CODE&gt;dt_id_tri&lt;/CODE&gt; with the following columns: &lt;CODE&gt;Ref Produit&lt;/CODE&gt;, &lt;CODE&gt;Baie&lt;/CODE&gt;, and &lt;CODE&gt;ID&lt;/CODE&gt;. After that, take a &lt;CODE&gt;Ref Produit&lt;/CODE&gt; from the dataset and calculate the total number of duplicates (&lt;CODE&gt;nb_total_doubl&lt;/CODE&gt;) for that &lt;CODE&gt;Ref Produit&lt;/CODE&gt;, and include it in a JMP report with the message: 'The total number of duplicates for Ref Produit: ' || &lt;CODE&gt;Ref Produit&lt;/CODE&gt; || ' is: ' || ...&lt;BR /&gt;For the second part, do the same for all &lt;CODE&gt;Ref Produit&lt;/CODE&gt; and generate a report that contains all &lt;CODE&gt;Ref Produit&lt;/CODE&gt; with a message for each one: 'The total number of duplicates for Ref Produit: ' || &lt;CODE&gt;Ref Produit&lt;/CODE&gt; || ' is: ' || ...""&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here( 1 );

// Open the data table
dt = Open( "D:/Project JMP/Tables Données/SVI/TableData SVI.jmp", invisible );

// Filter valid IDs: not empty, not equal to "-" or "NOK"
dt_id_tri = dt &amp;lt;&amp;lt; Select Where( 
    (:ID != "") &amp;amp; 
    (:ID != "-") &amp;amp; 
    (:ID != "NOK")
);

// Create a new table with the columns Ref Produit, Baie, ID
dt_id_tri = dt &amp;lt;&amp;lt; Subset( 
    All rows, 
    columns( :Ref Produit, :Baie, :ID )
);

// Calculate duplicates for a single Ref Produit
one_ref_produit = "22055";
dt_summary_one_ref = dt_id_tri &amp;lt;&amp;lt; Summary( 
    Group( :ID ), 
    Freq( "N" ), 
    Where( :Ref Produit == one_ref_produit )
);

// Filter duplicates where the frequency (Freq) is greater than 1
nb_total_doubl_one_ref = N Row( dt_summary_one_ref &amp;lt;&amp;lt; Select Where( :N Rows &amp;gt; 1 ) );
report_single_ref = "The total number of duplicates for Ref Produit: " || one_ref_produit || " is: " || nb_total_doubl_one_ref;
Show( report_single_ref );

// Calculate duplicates for all Ref Produit
refs = dt_id_tri &amp;lt;&amp;lt; Get As Matrix( :Ref Produit );
refs = Remove Duplicates( refs );

// Loop through all Ref Produit
For( i = 1, i &amp;lt;= N Items( refs ), i++,
    dt_summary_ref = dt_id_tri &amp;lt;&amp;lt; Summary( 
        Group( :ID ), 
        Freq( "N" ), 
        Where( :Ref Produit == refs[i] )
    );
    
    // Filter duplicates where the frequency is greater than 1
    nb_total_doubl = N Row( dt_summary_ref &amp;lt;&amp;lt; Select Where( :N Rows &amp;gt; 1 ) );
    report_all_ref = "The total number of duplicates for Ref Produit: " || refs[i] || " is: " || nb_total_doubl;
    Show( report_all_ref );
);&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;BR /&gt;I did get this error :&amp;nbsp;&lt;/P&gt;&lt;P&gt;/*:&lt;/P&gt;&lt;P&gt;NRow or NCol argument must be a Matrix or Data Table at row 1 in access or evaluation of 'N Row' , Bad Argument( Scriptable[] ), N Row/*###*/(dt_summary_one_ref &amp;lt;&amp;lt; Select Where( :N Rows &amp;gt; 1 ))&lt;/P&gt;&lt;P&gt;at line 28 in C:\Users\Script.jsl&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;Thank you.&lt;/P&gt;</description>
    <pubDate>Thu, 26 Sep 2024 08:39:24 GMT</pubDate>
    <dc:creator>Yass</dc:creator>
    <dc:date>2024-09-26T08:39:24Z</dc:date>
    <item>
      <title>Bad Argument( Scriptable[] )</title>
      <link>https://community.jmp.com/t5/Discussions/Bad-Argument-Scriptable/m-p/801984#M97794</link>
      <description>&lt;P&gt;Hello&amp;nbsp;everyone,&lt;BR /&gt;&lt;BR /&gt;I have a problem with my script, i want to do a study :&lt;BR /&gt;It's about filtering the IDs, avoiding IDs that are empty, equal to "-" or equal to "NOK". Then, these filtered IDs should be placed in a new table called &lt;CODE&gt;dt_id_tri&lt;/CODE&gt; with the following columns: &lt;CODE&gt;Ref Produit&lt;/CODE&gt;, &lt;CODE&gt;Baie&lt;/CODE&gt;, and &lt;CODE&gt;ID&lt;/CODE&gt;. After that, take a &lt;CODE&gt;Ref Produit&lt;/CODE&gt; from the dataset and calculate the total number of duplicates (&lt;CODE&gt;nb_total_doubl&lt;/CODE&gt;) for that &lt;CODE&gt;Ref Produit&lt;/CODE&gt;, and include it in a JMP report with the message: 'The total number of duplicates for Ref Produit: ' || &lt;CODE&gt;Ref Produit&lt;/CODE&gt; || ' is: ' || ...&lt;BR /&gt;For the second part, do the same for all &lt;CODE&gt;Ref Produit&lt;/CODE&gt; and generate a report that contains all &lt;CODE&gt;Ref Produit&lt;/CODE&gt; with a message for each one: 'The total number of duplicates for Ref Produit: ' || &lt;CODE&gt;Ref Produit&lt;/CODE&gt; || ' is: ' || ...""&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here( 1 );

// Open the data table
dt = Open( "D:/Project JMP/Tables Données/SVI/TableData SVI.jmp", invisible );

// Filter valid IDs: not empty, not equal to "-" or "NOK"
dt_id_tri = dt &amp;lt;&amp;lt; Select Where( 
    (:ID != "") &amp;amp; 
    (:ID != "-") &amp;amp; 
    (:ID != "NOK")
);

// Create a new table with the columns Ref Produit, Baie, ID
dt_id_tri = dt &amp;lt;&amp;lt; Subset( 
    All rows, 
    columns( :Ref Produit, :Baie, :ID )
);

// Calculate duplicates for a single Ref Produit
one_ref_produit = "22055";
dt_summary_one_ref = dt_id_tri &amp;lt;&amp;lt; Summary( 
    Group( :ID ), 
    Freq( "N" ), 
    Where( :Ref Produit == one_ref_produit )
);

// Filter duplicates where the frequency (Freq) is greater than 1
nb_total_doubl_one_ref = N Row( dt_summary_one_ref &amp;lt;&amp;lt; Select Where( :N Rows &amp;gt; 1 ) );
report_single_ref = "The total number of duplicates for Ref Produit: " || one_ref_produit || " is: " || nb_total_doubl_one_ref;
Show( report_single_ref );

// Calculate duplicates for all Ref Produit
refs = dt_id_tri &amp;lt;&amp;lt; Get As Matrix( :Ref Produit );
refs = Remove Duplicates( refs );

// Loop through all Ref Produit
For( i = 1, i &amp;lt;= N Items( refs ), i++,
    dt_summary_ref = dt_id_tri &amp;lt;&amp;lt; Summary( 
        Group( :ID ), 
        Freq( "N" ), 
        Where( :Ref Produit == refs[i] )
    );
    
    // Filter duplicates where the frequency is greater than 1
    nb_total_doubl = N Row( dt_summary_ref &amp;lt;&amp;lt; Select Where( :N Rows &amp;gt; 1 ) );
    report_all_ref = "The total number of duplicates for Ref Produit: " || refs[i] || " is: " || nb_total_doubl;
    Show( report_all_ref );
);&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;BR /&gt;I did get this error :&amp;nbsp;&lt;/P&gt;&lt;P&gt;/*:&lt;/P&gt;&lt;P&gt;NRow or NCol argument must be a Matrix or Data Table at row 1 in access or evaluation of 'N Row' , Bad Argument( Scriptable[] ), N Row/*###*/(dt_summary_one_ref &amp;lt;&amp;lt; Select Where( :N Rows &amp;gt; 1 ))&lt;/P&gt;&lt;P&gt;at line 28 in C:\Users\Script.jsl&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;Thank you.&lt;/P&gt;</description>
      <pubDate>Thu, 26 Sep 2024 08:39:24 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Bad-Argument-Scriptable/m-p/801984#M97794</guid>
      <dc:creator>Yass</dc:creator>
      <dc:date>2024-09-26T08:39:24Z</dc:date>
    </item>
    <item>
      <title>Re: Bad Argument( Scriptable[] )</title>
      <link>https://community.jmp.com/t5/Discussions/Bad-Argument-Scriptable/m-p/801994#M97795</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;dt_summary_ref &amp;lt;&amp;lt; Select Where( :N Rows &amp;gt; 1 )&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;will just select rows, it won't return a list or anything else. You have to get selected rows separately by using &amp;lt;&amp;lt; get selected rows or use other method of calculating the row count.&lt;/P&gt;</description>
      <pubDate>Thu, 26 Sep 2024 08:47:03 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Bad-Argument-Scriptable/m-p/801994#M97795</guid>
      <dc:creator>jthi</dc:creator>
      <dc:date>2024-09-26T08:47:03Z</dc:date>
    </item>
  </channel>
</rss>

