<?php require_once( dirname(dirname(dirname( __FILE__ ))) . '/wp-load.php' ); ?>
<!-- START of header -->
<?php get_header(); ?>
<!-- END of header -->

<!-- warapper -->

<div class="docs-content">
<!-- START of page navigation -->
<?php get_template_part( 'docs_navigation' ); ?>
<!-- END of page navigation -->
<!-- START of pusher -->
<div class="docs-content-body">
<div id="content" class="docs-content-body__inner">

<h1 class="title">5.1.14 TimeSeries Data Deletion</h1>
<h2 id="overview">Overview</h2>
<p>This section describes deleting data in a TimeSeries container.</p>
<p><br/></p>
<h2 id="data-deletion">Data deletion</h2>
<p>To delete the data (row) in a TimeSeries container, specify the timestamp of the rows you want to delete.</p>
<strong>List.1 Delete TimeSeries Data</strong> (TimeSeriesDeleteRow.java)
<pre class="prettyprint linenums:28">
SimpleDateFormat format = new SimpleDateFormat("yyyy/MM/dd HH:mm", Locale.US);

String containerName = "weather_station_1";
// Get TimeSeries Container
TimeSeries&lt;InstrumentLog&gt; logTs =
        store.getTimeSeries(containerName, InstrumentLog.class);
Date deleteTime = format.parse("2016/07/02 12:00");

System.out.println(containerName + " ################");
System.out.println("Timestamp\t\t\tWeatherStation ID\tTemperture");

// Delete the Instrument log of the specified time
boolean deleteSuccessed = logTs.remove(deleteTime);
System.out.println("Delete Result:" + deleteSuccessed);

InstrumentLog log = logTs.get(format.parse("2016/07/02 12:00"));
if (log == null) {
    System.out.println("Deleted log at 2016/07/02 12:00");
}
</pre>
<ul>
<li>L.41: Specify the timestamps of the data to remove using the <code>TimeSeries.remove(Date)</code> method. Here the time stamp is <code>2016/07/02 12:00</code>. If the deletion is successful, it will return is true.</li>
</ul>
<p><br/> Execution results are as follows.</p>
<strong>List.2 Result</strong>
<pre>
Delete Result: true
Deleted log at 2016/07/02 12:00
</pre>
<p>You can check that the specified data has been deleted.</p>
<h2 id="complete-source-code">Complete source code</h2>
<p>Complete source code used in this sample can be downloaded from the following.</p>
<p>Download: <a href="img/timeseries-delete.zip">timeseries-delete.zip</a></p>
<p><br/></p>
</div>
</div>
</div>
</div>
</div>

<!-- / main -->

<?php get_footer(); ?>
