Guest User

Guest User

  • Tech Writer
  • 2.1k
  • 469.5k

Why in thingspeak you only read data as multiple fields?

Nov 18 2019 4:58 AM
Hi Team
 
Who can explain to me as to why in thingspeak, you only have limited option to chose either read one field? But your data format on JSON or CSV show all feeds not one you wish to see? I am having that issue now with my CSV file format, on my URL i am passing correct request as field 1.json format. But the file format seem to give me all feeds. 
 
 
<div class = "custom-control custom-checkbox">
<input type="checkbox" class ="custom-control-input" id="temperature">
<label class = "custom-control-label" for="temperature">Temperature</label>
</div>
<div class = "custom-control custom-checkbox">
<input type = "checkbox" class="custom-control-input" id="illuminance">
<label class = "custom-control-label" for = "illuminance">Illuminance</label>
</div>
<div class ="custom-control custom-checkbox">
<input type ="checkbox" class="custom-control-input" id="button-state">
<label class ="custom-control-label" for = "button-state">Button-State</label>
<!---Downloading File using
Jquery with Buttons---->
<div class="form-group"><br>
<div class="col-md-1.9 text-center">
<button id="download" name="download" class="btn btn-warning" >Download</button><br>
</div>
</div>
 
// Downloading file into csv/json format.
$(document).ready(function() {
$("#download").click(function() {
var count = 0;
if($('#temperature').prop('checked')) count++;
if($('#illuminance').prop('checked')) count++;
if($('#button-state').prop('checked')) count++;
if(count > 1) {
window.location.href ='https://api.thingspeak.com/channels/899906/feeds.json?start=2019-11-14%2019:11:14&end=2019-11-18%2019:11:18';
}else{
// checking for one field being checked.
if($('#temperature').prop('checked')) count--;
if($('#illuminance').prop('checked')) count--;
if($('#button-state').prop('checked')) count--;
if(count < 1) {
window.location.href = ' https://api.thingspeak.com/channels/899906/fields/1.json?start=2019-11-15%2019:11:15&end=2019-11-18';
}
}
});
});
 

Answers (1)