1. Tracy Lamb
  2. PowerBuilder
  3. Saturday, 21 September 2024 21:01 PM UTC

Hi!

Can anyone tell me what's wrong with this syntax?

IF ISNUMBER(as_tolerance) THEN
	ls_compare = "NUMBER"
	ldec_tolerance = dec(as_tolerance)
ELSEIF right(trim(as_tolerance),1) = "%" THEN
	IF ISNUMBER( left(trim(as_tolerance),len(as_tolerance)-1))
		ls_compare = "PERCENT"
		ldec_tolerance = left(trim(as_tolerance),len(as_tolerance)-1)
	END IF
//ELSEIF lower(right(trim(as_tolerance), 5) ) = "units" then
//	IF ISNUMBER(left(trim(as_tolerance), len(as_tolerance) - 5)) THEN
//		ls_compare = "UNITS"
//		ldec_tolerance = dec(left(as_tolerance, len(as_tolerance) - 5))
ELSE
	return "U"
END IF

I keep getting a syntax error when trying to save at the line that says IF IsNumber... right after the first ElseIf statement. Trying to determine if what I'm comparing is hard numbers, percentages, or (later) units.

Probably a rookie mistake, but I'm not seeing it.  Using PB2022 R3.

TIA,
~~~Tracy

Accepted Answer
Arnd Schmidt Accepted Answer Pending Moderation
  1. Saturday, 21 September 2024 23:45 PM UTC
  2. PowerBuilder
  3. # Permalink

Looks like a missing THEN

IF ISNUMBER( left(trim(as_tolerance),len(as_tolerance)-1))THEN

hth

Arnd

Comment
  1. Tracy Lamb
  2. Sunday, 22 September 2024 13:18 PM UTC
Thank you Arnd! I knew it was something dumb, but just couldn't see it!

~~~Tracy
  1. Helpful
There are no comments made yet.


There are replies in this question but you are not allowed to view the replies from this question.