Still having some challenges with Selects and looking for clarification.
The options for the select input are Grey, Dark, Yellow, with values same as labels.
the selectedElement is a qodly string source selectedColor
I pass the selected Element to function:
function returnWeather(string:selectedColor)→weather:string
switch
:(selectedColor == "Grey")
weather = "Rainy"
:(selectedColor == "Yellow"
weather = "Sunny"
:(selectedColor == "Dark"
weather = "Nighttime"
else
weather = "I can't tell"
end
If the user does not make a selection and an “Empty”? selectedElement is passed to the function, I get Parameter type Mismatch error. Can someone confirm if the following is correct:
- We MUST always set the qodlysource type for selected elements in Selects as a variant. Otherwise, if the qodlysource value is not selected and passed to a function that is looking for a string/object/entity, the function will return error because a null or undefined was passed.
- Once the selected Element is passed into the function as a variant, it is ok to do tests like: selectedElement == “Rainy” without issue.
- if we want to confirm that the user did not make a selection we could also test in the function if selectedElement == null
Thanks for confirming or redirecting/refining. Instinctively I setup the qodlysource as object/string/entity/number etc. but this seems like this can be problematic for selected Elements in iterative qodlysources.