Sue,
Have you considered using your RDBMS to perform the qualification?
For intricate validations I frequently find it's easier to create a user
defined function in your database, then run a Set Fields SQL command in
ARS to perform the validation. You can then call your function many
times throughout your ARS application without additional validation
programming.
Here is a SQL Server function that returns the number of gigabytes if
the number passed is between 1 and 1000 (change the range to match your
requirements).
CREATE FUNCTION [dbo].[udf_ValidateRequestedDiskspace]
(
@Diskspace VARCHAR(20)
)
RETURNS INT
AS
BEGIN
IF @Diskspace = NULL OR ISNUMERIC(@Diskspace) = 0
RETURN NULL
DECLARE @Tmp BIGINT
SET @Tmp = CONVERT(INT,ROUND(CONVERT(FLOAT,@Diskspace),0))
IF @Tmp <= 0 OR @Tmp > 1000
RETURN NULL
RETURN CONVERT(INT,@Tmp)
END
In workflow: Set Fields, SQL, SELECT
dbo.udf_ValidateRequestedDiskspace('$Requested storage amount in GB:
$'). The next Filter would then check your field for $NULL $. If null,
then display a message to the user.
Stephen
-----Original Message-----
From: Action Request System discussion list(ARSList)
[mailto:[EMAIL PROTECTED] On Behalf Of Rabi Tripathi
Sent: Friday, March 30, 2007 4:00 PM
To: [email protected]
Subject: Re: Validate field data - allowing some to be NULL
Strange. Make sure you have the "^" in the qual.
--- "Barber, Sue" <[EMAIL PROTECTED]> wrote:
> This is still allowing me to enter text into the field as well as
> numbers. It is getting closer though - I will post whatever Remedy
> tells me when I hear back. Thanks for the help.
>
> Sue
>
> -----Original Message-----
> From: Action Request System discussion list(ARSList)
> [mailto:[EMAIL PROTECTED] On Behalf Of Rabi Tripathi
> Sent: Friday, March 30, 2007 12:33 PM
> To: [email protected]
> Subject: Re: Validate field data - allowing some to be NULL
>
> Sue:
> I am not sure why you gave up on the character field.
>
> Did you try the qualification I sent? Using that or a variaion of it,
> you can keep the character field and be in complete control of the
> type of message the user gets.
>
> Here's a refined scheme:
> First do the following Set Field...
> RTRIM( LTRIM( 'Requested storage amount in GB: '))
>
> ...on field 'Requested storage amount in GB: ' to remove leading and
> trailing blank characters and then use the qualification:
>
> ( 'Requested storage amount in GB: ' LIKE "*[^.0-9]*" ) OR (
> 'Requested storage amount in GB: ' LIKE "*.*.*"
> )
> OR ( 'Requested storage amount in GB: ' = "." ) on a filter to throw
> the error.
>
> If the field won't be used in a numeric calculation, there is no harm
> in keeping it as a character field.
>
> --- "Barber, Sue" <[EMAIL PROTECTED]> wrote:
>
> > I think I will have to go with changing the field
> -
> > I still have to
> > throw an error though - they don't want the system message. I was
> > hoping not to change the field as this is already
> in
> > use.
> >
> > Thanks, Sue
> >
> > -----Original Message-----
> > From: Action Request System discussion
> list(ARSList)
> > [mailto:[EMAIL PROTECTED] On Behalf Of Rabi Tripathi
> > Sent: Friday, March 30, 2007 11:04 AM
> > To: [email protected]
> > Subject: Re: Validate field data - allowing some
> to
> > be NULL
> >
> > If you insist on keeaping the character field,
> try:
> > ( 'Requested storage amount in GB: ' LIKE "*[^.0-9]*"
> > ) OR ( 'Requested storage amount in GB: ' LIKE "*.*.*" )...then
> > throw error
> >
> > You can play around and make it smarter by
> allowing
> > leading or trailing spaces, disallowing "." etc.
> >
> > -Rabi Tripathi
> >
> > --- "Barber, Sue" <[EMAIL PROTECTED]> wrote:
> >
> > > Hi all,
> > >
> > >
> > >
> > > I have a question for you on validating field
> > data.
> > > I did search the
> > > archives and it isn't allowing me to open the
> > notes
> > > - says file not
> > > found, sooo...
> > >
> > >
> > >
> > > I have a form that people can use to request additional network
> > > space with and the field in question is for them to
> > enter
> > > the amount of space
> > > in GB that they want. I originally had the
> field
> > > limited with $DIGIT$,
> > > but when they made a mistake the entire form was being reset.
> > > They decided they would like a message to be used instead, so I
> > > have created a filter that verifies the field as such:
> > >
> > >
> > >
> > > ( 'Requested storage amount in GB: ' != $NULL$ )
>
> > > AND ( NOT (
> > > 'Requested storage amount in GB: ' LIKE "[.0-9][.0-9][.0-9]
> > > [.0-9][.0-9]"))
> > >
> > >
> > >
> > > However, I don't want to force them to enter a number into all 5
> > > spaces, so I need to allow 4 of these to be
> NULL.
> > > Anyone know if there
> > > is a way to do that? They want to be able to
> > enter
> > > numbers or
> > > decimals - like 2 or 2.5.
> > >
> > >
> > >
> > > Thanks, Sue
> > >
> > >
> > >
> > > ARS 6.3 - patch 20
> > >
> > > Solaris
> > >
> > > Help Desk 6
> > >
> > >
> > >
> > >
_______________________________________________________________________________
UNSUBSCRIBE or access ARSlist Archives at www.arslist.org ARSlist:"Where the
Answers Are"