Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Problem with if statement

Former Member
0 Likes
790

I am using a if statement like

if n = 'times'

else.

endif.

N is a parameter defined on screen..Now if the user enters TIMES (caps lock on) ideally it should pass the condition ( Upper case doesnt make any difference in my program ) But it is failing because of IF statement being case sensitive.

How should I make my IF statement case insensitive... ie whether user enters 'times' or 'TIMES' it should pass the condition??

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
761

HI Priya,

If you have already hardcoded the condition with small letters, then simply translate the N value with small letters & then pass to if condition.

translate N lowercase.

if n = 'times'
{ exp}
else.
{ exp }
endif.

Best regards,

Prashant

7 REPLIES 7
Read only

Former Member
0 Likes
762

HI Priya,

If you have already hardcoded the condition with small letters, then simply translate the N value with small letters & then pass to if condition.

translate N lowercase.

if n = 'times'
{ exp}
else.
{ exp }
endif.

Best regards,

Prashant

Read only

Former Member
0 Likes
761

instead of n = 'times'

use

n eq 'times'

nd what did u declare n as

is n a character or string

if u declared n as string

then use n eq times

Read only

Former Member
0 Likes
761

hi,

to your select-parameter give lower-case,

what ever the user enters TIMES ot times it accepts lin lower case and you can pass the if condition.

parameter: p_file(255) type c lower case.

regards,

nazeer

Read only

Former Member
0 Likes
761

hi,

opps.. posted tiwce..

ignore

to your select-parameter give lower-case,

what ever the user enters TIMES ot times it accepts lin lower case and you can pass the if condition/

regards,

nazeer

Edited by: N a z e e r on Jan 15, 2009 5:33 PM

Read only

Former Member
0 Likes
761

Hi,

PARAMETER: n type string LOWER CASE.

If n = 'TIMES'.

WRITE:/ 'hi'.

else.

WRITE:/ 'wrong'.

endif.

The above code will work for ur requirement.

Thanks.

Read only

Former Member
0 Likes
761
Translate the value in upper case before passing it to if condition.
Read only

Former Member
0 Likes
761

Hi,

Use Hard coded value in Capital Letter.


PARAMETER: n type string .
 
If n  EQ 'TIMES'.

EXP.

else.

WRITE:/ EXP.
endif.

Hope it will work for your requirment.

Thanks

Arun Kayal.

Thanks.