Note that there are some explanatory texts on larger screens.

plurals
  1. POIf statement is not working properly
    primarykey
    data
    text
    <p>I'm trying to change the condition in which data is written to a table. I noticed a strange result when trying to change this: it seems WriteToTable function would runno matter what if condition I subjected it to. To test this I did the following:</p> <pre><code>var TestThis=0; if (TestThis=1000){ WriteToTable(iPlaceDisplayNum, place.name, place.rating, xScoreFinal, iProspect, place.url, place.formatted_phone_number); alert ('This alert should not be displaying.'); } </code></pre> <p>The function will still execute and the alert will be still be displayed when the script runs. I'm not sure why?</p> <p>Here's the rest of the function, the problem is towards the bottom:</p> <pre><code>function printme(place, status) { if (status == google.maps.places.PlacesServiceStatus.OK) { if (typeof place.reviews !== 'undefined') { var xScore = 0; var xGlobal = 0; for (var i = 0; i &lt; place.reviews.length; i++) { reviews = place.reviews[i]; for (var x = 0; x &lt; reviews.aspects.length; x++) { aspectr = reviews.aspects[x]; xScore += aspectr.rating; xGlobal++; } } var xScoreFinal = (xScore / xGlobal); } if (typeof xScoreFinal !== 'undefined') { iPlaceDisplayNum++; var iProspect; if (xScoreFinal &lt; 2.3) { iProspect = 'Yes'; } //Not sure what's going on here var TestThis=0; if (TestThis=1000){ WriteToTable(iPlaceDisplayNum, place.name, place.rating, xScoreFinal, iProspect, place.url, place.formatted_phone_number); alert ('This alert should not be displaying.'); } } } } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload