<?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: How to script date of the current month for data compilation in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/How-to-script-date-of-the-current-month-for-data-compilation/m-p/736221#M91695</link>
    <description>&lt;P&gt;&lt;SPAN&gt;Can you explain the process of scripting the date of the current month to ensure accurate data compilation?&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Tue, 19 Mar 2024 07:38:11 GMT</pubDate>
    <dc:creator>Kathlyn</dc:creator>
    <dc:date>2024-03-19T07:38:11Z</dc:date>
    <item>
      <title>How to script date of the current month for data compilation</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-script-date-of-the-current-month-for-data-compilation/m-p/689508#M87541</link>
      <description>&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have the following code which does not work :&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;// Current date
aujourd'hui = Text(Today(),"00000000");

// Obtain the month number format "MM"
numero_mois = Text(Month(aujourd'hui), "00");

// Obtain the year number - 1 format YYYY
numero_annee = Text(Year(aujourd'hui) - 1, "0000");

// Concatenate the result
date_debut_mois_actuel_Y = ("01" || numero_mois || numero_annee);

// Show the result
Show(date_debut_mois_actuel_Y);

dt &amp;lt;&amp;lt; Select Where(:Date &amp;lt; date_debut_mois_actuel_Y);
dt &amp;lt;&amp;lt; Delete rows;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;The objective is to select all rows from dt (Data Table) for which the date is &amp;lt; 01/current month/current year -1, and to delete them.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I understand the error, that I cannot concatenate other elements than character, but how can I obtain the date under the format 01/10/2022 (expecation of today for example), without go back to the code and change manually the date.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The error message is : argument should be character at row xxx in access or evaluation of 'Concat' , Bad Argument( numero_mois ), "01" || /*###*/numero_mois || /*###*/numero_annee/*###*/&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Up to date the code is (to be modified manually each month) :&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;dt &amp;lt;&amp;lt; select where(:name("date") &amp;lt; informat("01102022","DDMMYYYY"));
dt &amp;lt;&amp;lt; Delete rows;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Thank you very much !&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Best regards&lt;/P&gt;</description>
      <pubDate>Mon, 23 Oct 2023 14:10:19 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-script-date-of-the-current-month-for-data-compilation/m-p/689508#M87541</guid>
      <dc:creator>Arkawa</dc:creator>
      <dc:date>2023-10-23T14:10:19Z</dc:date>
    </item>
    <item>
      <title>Re: How to script date of the current month for data compilation</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-script-date-of-the-current-month-for-data-compilation/m-p/689537#M87546</link>
      <description>&lt;P&gt;You are making the issue more complex than required.&amp;nbsp; Here is how I would do it:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;dt &amp;lt;&amp;lt; select where( :Date &amp;lt; Date MDY( 1, Month( today ), Year( Today() ) - 1 ) );
try( dt &amp;lt;&amp;lt; delete rows );&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 23 Oct 2023 14:56:24 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-script-date-of-the-current-month-for-data-compilation/m-p/689537#M87546</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2023-10-23T14:56:24Z</dc:date>
    </item>
    <item>
      <title>Re: How to script date of the current month for data compilation</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-script-date-of-the-current-month-for-data-compilation/m-p/689538#M87547</link>
      <description>&lt;P&gt;You can get the current date using &lt;A href="https://www.jmp.com/support/help/en/17.0/#page/jmp/date-and-time-functions.shtml?os=win&amp;amp;source=application#ww3597990" target="_blank" rel="noopener"&gt;Today()&lt;/A&gt; and one option for getting first day of month is using &lt;A href="https://www.jmp.com/support/help/en/17.0/#page/jmp/date-and-time-functions.shtml?os=win&amp;amp;source=application#ww2538996" target="_blank" rel="noopener"&gt;Date Increment()&lt;/A&gt;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here(1);
Date Increment(Today(), "Month", 0, "start");&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;and then depending on your data you can directly use this without performing any Char transforms (in JMP you use &lt;A href="https://www.jmp.com/support/help/en/17.0/#page/jmp/character-functions-2.shtml?os=win&amp;amp;source=application#ww2455750" target="_blank" rel="noopener"&gt;Char()&lt;/A&gt; not Text() which ChatGPT? tries to use).&lt;/P&gt;</description>
      <pubDate>Mon, 23 Oct 2023 14:53:22 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-script-date-of-the-current-month-for-data-compilation/m-p/689538#M87547</guid>
      <dc:creator>jthi</dc:creator>
      <dc:date>2023-10-23T14:53:22Z</dc:date>
    </item>
    <item>
      <title>Re: How to script date of the current month for data compilation</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-script-date-of-the-current-month-for-data-compilation/m-p/689849#M87584</link>
      <description>&lt;P&gt;Hi txnelson and jthi, thanks for your help, the following code is working&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;dt &amp;lt;&amp;lt; select where( :Date &amp;lt; Date DMY( 1, Month( today ), Year( Today() ) - 1 ) );&lt;/LI-CODE&gt;&lt;P&gt;I just changed the Date MDY to Date DMY.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;We learn everyday with JMP :).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Best regards !&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 24 Oct 2023 07:51:51 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-script-date-of-the-current-month-for-data-compilation/m-p/689849#M87584</guid>
      <dc:creator>Arkawa</dc:creator>
      <dc:date>2023-10-24T07:51:51Z</dc:date>
    </item>
    <item>
      <title>Re: How to script date of the current month for data compilation</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-script-date-of-the-current-month-for-data-compilation/m-p/694701#M87985</link>
      <description>&lt;P&gt;Dear all,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Today I realized that the code doesn't seem to work when two months overlap, example today : 06/11/2023 - 7 days = 30/10/2023.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I did not find the solution, should I highlight conditions ? (by using "if").&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;Best regards&lt;/P&gt;</description>
      <pubDate>Mon, 06 Nov 2023 10:24:58 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-script-date-of-the-current-month-for-data-compilation/m-p/694701#M87985</guid>
      <dc:creator>Arkawa</dc:creator>
      <dc:date>2023-11-06T10:24:58Z</dc:date>
    </item>
    <item>
      <title>Re: How to script date of the current month for data compilation</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-script-date-of-the-current-month-for-data-compilation/m-p/694702#M87986</link>
      <description>&lt;P&gt;I'm not exactly sure what you mean by "two months overlap"? Didn't mean to delete all rows which are earlier than first day of current month last year? Where is the -7 days coming from?&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here(1);

dt = New Table("Dates",
	Add Rows(1000),
	New Column("Date", Numeric, Continuous, Format("yyyy-mm-dd", 10), Set Each Value(
		Today() - In Days(Row())
	))
);
dt &amp;lt;&amp;lt; Sort(By(:Date), Replace Table, Order(Ascending));
dt &amp;lt;&amp;lt; Select Where(
	:Date &amp;lt; Date Increment(Today() - In Years(1), "Month", 0, "start");
);

// dt &amp;lt;&amp;lt; select where(:Date &amp;lt; Date DMY(1, Month(Today()), Year(Today()) - 1));

/*
dt &amp;lt;&amp;lt; Previous Selected;
*/&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 06 Nov 2023 10:46:46 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-script-date-of-the-current-month-for-data-compilation/m-p/694702#M87986</guid>
      <dc:creator>jthi</dc:creator>
      <dc:date>2023-11-06T10:46:46Z</dc:date>
    </item>
    <item>
      <title>Re: How to script date of the current month for data compilation</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-script-date-of-the-current-month-for-data-compilation/m-p/694703#M87987</link>
      <description>&lt;P&gt;Hi jthi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I would like to delete all rows prior to today - 7 days (regardless of the current month and year) :).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you !&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Best regards&lt;/P&gt;</description>
      <pubDate>Mon, 06 Nov 2023 11:13:43 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-script-date-of-the-current-month-for-data-compilation/m-p/694703#M87987</guid>
      <dc:creator>Arkawa</dc:creator>
      <dc:date>2023-11-06T11:13:43Z</dc:date>
    </item>
    <item>
      <title>Re: How to script date of the current month for data compilation</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-script-date-of-the-current-month-for-data-compilation/m-p/694735#M87991</link>
      <description>&lt;P&gt;Here are few options on how you can select those rows. Example table is there so it is easier to see which rows are being selected&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Names Default To Here(1);

dt = New Table("Dates",
	Add Rows(1000),
	New Column("Date", Numeric, Continuous, Format("yyyy-mm-dd", 10), Set Each Value(
		Today() - In Days(Row())
	))
);
dt &amp;lt;&amp;lt; Sort(By(:Date), Replace Table, Order(Ascending));
dt &amp;lt;&amp;lt; Select Where(
	:Date &amp;lt; Date Increment(Today() - In Days(7), "Day", 0, "start");
);

// or using Date Difference
// dt &amp;lt;&amp;lt; Select Where(Date Difference(:Date, Today(), "Day") &amp;gt; 7);

// comparison between date and today (depending in your data, removing time of day might be needed)
// dt &amp;lt;&amp;lt; Select Where(:Date - Time Of Day(:Date) &amp;lt; Today() - In Days(7) - Time Of Day(Today()));

/*
dt &amp;lt;&amp;lt; Previous Selected;
*/&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 06 Nov 2023 12:58:24 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-script-date-of-the-current-month-for-data-compilation/m-p/694735#M87991</guid>
      <dc:creator>jthi</dc:creator>
      <dc:date>2023-11-06T12:58:24Z</dc:date>
    </item>
    <item>
      <title>Re: How to script date of the current month for data compilation</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-script-date-of-the-current-month-for-data-compilation/m-p/694740#M87992</link>
      <description>&lt;P&gt;Hi jthi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks youn very much, this code&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;dt &amp;lt;&amp;lt; Select Where(Date Difference(:Date, Today(), "Day") &amp;gt; 7);&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;works perfectly !&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Best regards&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 06 Nov 2023 13:12:38 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-script-date-of-the-current-month-for-data-compilation/m-p/694740#M87992</guid>
      <dc:creator>Arkawa</dc:creator>
      <dc:date>2023-11-06T13:12:38Z</dc:date>
    </item>
    <item>
      <title>Re: How to script date of the current month for data compilation</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-script-date-of-the-current-month-for-data-compilation/m-p/736221#M91695</link>
      <description>&lt;P&gt;&lt;SPAN&gt;Can you explain the process of scripting the date of the current month to ensure accurate data compilation?&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 19 Mar 2024 07:38:11 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-script-date-of-the-current-month-for-data-compilation/m-p/736221#M91695</guid>
      <dc:creator>Kathlyn</dc:creator>
      <dc:date>2024-03-19T07:38:11Z</dc:date>
    </item>
    <item>
      <title>Re: How to script date of the current month for data compilation</title>
      <link>https://community.jmp.com/t5/Discussions/How-to-script-date-of-the-current-month-for-data-compilation/m-p/736233#M91698</link>
      <description>&lt;P&gt;If you just want first day of month, use Today() to get the todays date and then Month and Year with Date DMY to build your date&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;now = Today();
first_of_month = Date DMY(1, Month(now), Year(now));
Show(As Date(first_of_month));&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 19 Mar 2024 09:18:41 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-to-script-date-of-the-current-month-for-data-compilation/m-p/736233#M91698</guid>
      <dc:creator>jthi</dc:creator>
      <dc:date>2024-03-19T09:18:41Z</dc:date>
    </item>
  </channel>
</rss>

