Use vars in Strlen or ArrayIndexOf


Walter Hiller

Hello,

happy Easter to all! I just fight with a interesting problem. Please have a look at the examples below. Version 1 works as it should, Version 2 returns a -1 although [searchme] has the value "11_HILLER".

Same behavior i.e with StrLen.is it not possible to use a var as input?

Thanks,
Walter


DecSoft

Hello,

Maybe you found a bug in certain scenario, or maybe the problem is related with some "case sensitive" mistake. The below code works for me, then, try to investigate a little more, for example, assert "[searchme]" must be as is and not "[SearchMe]".



Walter Hiller

Hello David, thanks for your answer.
Do you think it could be a problem, because I define var [searchme] in the click of the Select1.SelItems? Means I SetVar "searchme" "[Select1.SelItems]" "String" ? Thanks, Walter


DecSoft

Hello Walter,

Yes; certainly could be the problem, maybe SelItems contains more than one item, and, on the other hand, what happend if no items are selected? Anyway may you can test it by place an "Alert" in your code, something like this:

This can be a quick way to look into the "[searchme]" variable contents...



Walter Hiller

Hello David,

I did the alert test from the begining and the alert always shows me the correct value, i.e 11_HILLER, that is what me drives crazy. I have to leave now, but will send you the app later! Thanks, Walter


DecSoft

Hello,

Please, Walter, sorry any inconvenience and, when you can, send me an application in which I can reproduce the problem. Then I will take a look in order to fix it as quickly as possible.



Walter Hiller

Hello and many thanks to David!

for all others: The solution is simple: The value of a MultiSelect control itsself is an array. This means if you want to search for the result of a single selection in an MultiSelect.Control you have to read first postion of the selected (answer) array:


DecSoft

That is the question! :)


Everybody can read the DecSoft support forum for learning purposes, however only DecSoft customers can post new threads. Purchase one or more licenses of some DecSoft products in order to give this and other benefits.

This website uses some useful cookies to store your preferences.

I agree. Hide this note. Give me more information.