General area when it fits no where else

Moderator: Mmiscool

User avatar
By Ecoli-557
#51365 Hello to All-
I am a noob to this forum and thanks to Mike - I now have some NodeMCUs which are working!
My question is this:
Is there a way that a Dropdown box can be used which would be filled with text, BUT, in which the variable is passed the NUMBER of the text in the Dropdown?
Example, say I have a Dropdown and it is to get the day of the week into var DOW. The box has Sunday, Monday, Tuesday..... Thursday, Friday, Saturday.
I do not want the text going into the Var, just the number which is associated with the selected element in the box.
In my example I selected Wednesday which I want DOW=4 (Sunday being 1).

Is this even possible? Apologies if this is somewhere I did no see.
It is similar to having a LOOKUP or a LOOKDOWN function.......
Regards to All.
User avatar
By forlotto
#51384 It used to be possible to do this I don't know if it still is the way varibles are handled in the 3.x branch seems to differ from previous versions and really even earlier versions than this the points at which you can call variables or track variables has changed and so have the methods I'm trying to figure this all out myself it is a fairly consistent learning curve.

But surely something similar was done at a point with wifi they would scan wifi's and put the access points in a dropdown list then allow you to select and connect to it with a password. Errr I cannot remember where the example was but if you work on this line by line just editing in your code you may be able to come up with something.
User avatar
By forlotto
#51385 Here was the code I was talking about:

Code: Select all[WifiSettings]
let listWifis = ""
n = wifi.scan()
n = n - 1
html "Number of network found = "
html n
for x = 1 to n
let listWifis = listWifis & wifi.ssid(x)
let listWifis = listWifis & ","
next x
wprint "<br>Select SSID: "
dropdown listWifis selectedWifi


might not be exact but should be a start something to build off of.