Page 1 of 1
NewRecord webtag showing "" instead of "0"
Posted: Sat 22 Oct 2022 9:32 am
by maxfieldg
Running version/build 3.22.2 (3213) and the NewRecord webtag is showing "" instead of "0" when no record has been set. I was testing for "0" and had to change my code to compensate for this value. Is it a bug? Or a new feature?
Re: NewRecord webtag showing "" instead of "0"
Posted: Sat 22 Oct 2022 9:42 am
by water01
Are you sure about that. I just ran an update of my PHP webtags and it is definitely set to zero.
Code: Select all
$newrecord = "0"; // value of 1 if the 'new record' light is flashing, 0 if not
What build of MX are you running?
Re: NewRecord webtag showing "" instead of "0"
Posted: Sat 22 Oct 2022 9:59 am
by maxfieldg
Version 3.22.2 build 3213, as mentioned in my original post. Definitely sure, it's always worked in previous builds
Re: NewRecord webtag showing "" instead of "0"
Posted: Sat 22 Oct 2022 10:20 am
by water01
Sorry missed the Build data.
Just ran it again and mine on the same build and it is definitely zero.
Code: Select all
$build = "3213"; // build of Cumulus in use
$timelong = "11:13 on October 22, 2022"; // current time (example format: 12:34 on January 01, 2011)
$newrecord = "0"; // value of 1 if the 'new record' light is flashing, 0 if not
Re: NewRecord webtag showing "" instead of "0"
Posted: Sat 22 Oct 2022 10:28 am
by maxfieldg
This is the section of my code that tests for new records.
<script type="text/javascript">
var NewRecord = "<#NewRecord>";
var TempRecord = "<#TempRecordSet>";
var WindRecord = "<#WindRecordSet>";
var RainRecord = "<#RainRecordSet>";
var HumidRecord = "<#HumidityRecordSet>";
var PressureRecord = "<#PressureRecordSet>";
if (NewRecord != "1") {
document.write("No");
} else {
document.write("Yes ");
if (TempRecord == "1") {
document.write("(Temperature)");
}
if (WindRecord == "1") {
document.write("(Wind)");
}
if (RainRecord == "1") {
document.write("(Rain)");
}
if (HumidRecord == "1") {
document.write("(Humidity)");
}
if (PressureRecord == "1") {
document.write("(Pressure)");
}
}
</script>
and this is the result from the webpage. As you can see the problem is worse, the RainRecordSet webtag is set to "1", but the NewRecord webtag is still set to "", so there is no way I can test for a record without testing all the other webtags individually.
<script type="text/javascript">
var NewRecord = "";
var TempRecord = "0";
var WindRecord = "0";
var RainRecord = "1";
var HumidRecord = "0";
var PressureRecord = "0";
if (NewRecord != "1") {
document.write("No");
} else {
document.write("Yes ");
if (TempRecord == "1") {
document.write("(Temperature)");
}
if (WindRecord == "1") {
document.write("(Wind)");
}
if (RainRecord == "1") {
document.write("(Rain)");
}
if (HumidRecord == "1") {
document.write("(Humidity)");
}
if (PressureRecord == "1") {
document.write("(Pressure)");
}
}
</script>
Re: NewRecord webtag showing "" instead of "0"
Posted: Sat 22 Oct 2022 10:34 am
by maxfieldg
Aaargh! It is case-sensitive, I had #NewRecord instead of #newrecord. Just changed it and it is now working. Cannot work out how it worked before, I'm sure it's been that for years....who knew?
Re: NewRecord webtag showing "" instead of "0"
Posted: Sat 22 Oct 2022 10:54 am
by water01
I was just about to say that, well at least you got there!!
