BaBernd
23rd April 2015, 10:58
Hello to All,

I've created an If-clause with a string comparison but it always Fails. Can you give me a hint.

----------------------------------------------
Branche.typ = trim$(tdsmi101.cfea)

if Branche.typ = "[Bb][Rr][Aa][Nn][Cc][Hh]*" then
get.code.data(Branche.bez)
else
message("IF Fails")
endif
----------------------------------------------

And I know that Branche.typ contains Minimum one value with "BRANCH1"

Why does the Wildcard "*" not work?

Best Regards
Bernd

JaapJD
23rd April 2015, 11:32
The if-statement does not allow regular expressions. You have to use the expr.compile() function to achieve this.
But maybe it is easier to to use

if str.startswith(tolower$(Branche.typ), "branch") then
...
endif

or even

if str.startswith(Branche.typ, "branch", true) then
...
endif

BaBernd
23rd April 2015, 14:10
Hello JaapJD,

your trick was Very helpful. It solves my Problem very effective.

Best Regards
Bernd