Author |
Message
|
mbtech |
Posted: Tue May 28, 2013 7:20 pm Post subject: Mandatory fields |
|
|
Apprentice
Joined: 18 Jul 2012 Posts: 36
|
i have a scenario where i have mandatory fields in input i have to validate them to be not having blanks null values and special characters
Code: |
If Input.XMLNSC.Field1 IS NOT NULL OR Input.XMLNSC.Field1 <> ' '
THEN THROW USER EXCEPTION 1111 VALUES (' MAnadtory field cannot have null balank or special characters'); |
NULL and Blanks values are fine may i know how to handle special characters |
|
Back to top |
|
 |
kash3338 |
Posted: Tue May 28, 2013 7:51 pm Post subject: Re: Mandatory fields |
|
|
Shaman
Joined: 08 Feb 2009 Posts: 709 Location: Chennai, India
|
mbtech wrote: |
NULL and Blanks values are fine may i know how to handle special characters |
For NULL and BLANK values, you can make use of the Message Set to do it for you. Why do you want to code for that?
As for special characters, what kind of special characters are you expecting in your message? Do you need to throw error for any special character or certain specific characters alone? Please be more specific in your requirement. |
|
Back to top |
|
 |
rekarm01 |
Posted: Tue May 28, 2013 8:43 pm Post subject: Re: Mandatory fields |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 1415
|
mbtech wrote: |
Code: |
THROW USER EXCEPTION 1111 ... |
|
For the THROW statement, the broker reserves a range of numbers from 2949 to 2999 for user exceptions. It's usually a better practice to just use numbers within that range.
mbtech wrote: |
may i know how to handle special characters |
One way to handle special characters is to use the TRANSLATE() function to delete non-special characters, and then check for what's left. |
|
Back to top |
|
 |
Tech1621 |
Posted: Wed May 29, 2013 1:32 am Post subject: Re: Mandatory fields |
|
|
Novice
Joined: 29 May 2013 Posts: 23
|
mbtech wrote: |
i have a scenario where i have mandatory fields in input i have to validate them to be not having blanks null values and special characters
Code: |
If Input.XMLNSC.Field1 IS NOT NULL OR Input.XMLNSC.Field1 <> ' '
THEN THROW USER EXCEPTION 1111 VALUES (' MAnadtory field cannot have null balank or special characters'); |
NULL and Blanks values are fine may i know how to handle special characters |
I suggest using Message set for excluding the possibility of special characters and in it just restrict the type. _________________ Anything is easy if you believe in yourself.. |
|
Back to top |
|
 |
mbtech |
Posted: Wed May 29, 2013 10:06 pm Post subject: Identifing blank fields at message set levl |
|
|
Apprentice
Joined: 18 Jul 2012 Posts: 36
|
What are the settings to be done at the message set level to throw an error when a field is blank? |
|
Back to top |
|
 |
|