String = Text
Thanks for helping @Nezmo!
When posting an expression, itās usually best to wrap it in a code block. You can use the </>
button in the toolbar or wrap the content in triple backticks to treat it as preformatted text
```
"Content here"
```
That preserves the formatting, spacing, and characters as-is.
Thanks Josh. I couldnāt remember if you could then copy and paste from a code block here but you can.
This has me foxed. I have no idea how that is happening. Did you delete the previous instance of that variable before recreating it as a text variable?
Yepā¦ There was no way to edit it. Deleted and started fresh.
Of course.
I need to defer to Josh on this one. I canāt recreate that.
@Nezmo -
I really appreciate your help. Iām closer than I was before. Iāll keep tinkering with it.
What does the expression look like? If there is an invalid variable in the expression when it is run, thatās what the result of it will be.
Edit: for example, it looks like you mean for $degrees
to be a local variable. In that case, it shouldnāt be prefixed with a $
as that tells the system, itās a global variable.
This is it, with a slight correction of one of the cardinals:
$degrees = $context.response.data.hourly.0.wind_deg
$degrees > 337 ? "NNW" : $degrees > 314 ? "NW" : $degrees > 292 ? "WNW" : $degrees > 269 ? "W" : $degrees > 247 ? "WSW" : $degrees > 224 ? "SW" : $degrees > 202 ? "SSW" : $degrees > 179 ? "S" : $degrees > 157 ? "SSE" : $degrees > 134 ? "SE" : $degrees > 112 ? "ESE" : $degrees > 89 ? āEā : $degrees > 67 ? "ENE" : $degrees > 44 ? "NE" : $degrees > 22 ? "NNE" : "N"
Ah, my bad!
Sometimes you just need fresh eyes.
Scratch that. I only deleted one of them. Waiting for the triggerā¦
No good. Same result.
Is this the correct expression?
degrees = $context.response.data.hourly.0.wind_deg
degrees > 337 ? "NNW" : $degrees > 314 ? "NW" : $degrees > 292 ? "WNW" : $degrees > 269 ? "W" : $degrees > 247 ? "WSW" : $degrees > 224 ? "S" : $degrees > 202 ? "SSW" : $degrees > 179 ? "S" : $degrees > 157 ? "SS" : $degrees > 134 ? "SE" : $degrees > 112 ? "ESE" : $degrees > 89 ? "S" : $degrees > 67 ? "ENE" : $degrees > 44 ? "NE" : $degrees > 22 ? "NNE" : "N"
EDIT: do I need to delete all 16 $ ( I guess that only makes sense )
No. It still has the references to $degrees
in several places. All of them have to be updated so they reference the same local variable.
They would all need to be replaced:
degrees = $context.response.data.hourly.0.wind_deg
degrees > 337 ? "NNW" : degrees > 314 ? "NW" : degrees > 292 ? "WNW" : degrees > 269 ? "W" : degrees > 247 ? "WSW" : degrees > 224 ? "S" : degrees > 202 ? "SSW" : degrees > 179 ? "S" : degrees > 157 ? "SS" : degrees > 134 ? "SE" : degrees > 112 ? "ESE" : degrees > 89 ? "S" : degrees > 67 ? "ENE" : degrees > 44 ? "NE" : degrees > 22 ? "NNE" : "N"
Try this:
degrees = $context.response.data.hourly.0.wind_deg
`degrees > 337 ? "NNW" : degrees > 314 ? "NW" : degrees > 292 ? "WNW" : degrees > 269 ? "W" : degrees > 247 ? "WSW" : degrees > 224 ? "SW" : degrees > 202 ? "SSW" : degrees > 179 ? "S" : degrees > 157 ? "SSE" : degrees > 134 ? "SE" : degrees > 112 ? "ESE" : degrees > 89 ? āEā : degrees > 67 ? "ENE" : degrees > 44 ? "NE" : degrees > 22 ? "NNE" : "N"`
And > 89 should be E