IF vslashchk = 0 and vdashchk = 0 and vlengthchk >= 7 and vdigitchk = 1 THEN
 GOTO phone
ENDIF

Couldn't there be a dash in a phone #. I have done: (999)999-9999 and 999.999.9999 and 9999999999. I am sure others have done variations on this. I was part of a small discussion on this issue at the conference. Phone numbers can be real pissers. In your case, I might just check for digits and if TRUE, then count digits to be certain there are 10. You might use SSUB and SLEN to march through the characters, counting the occurances of digits.

----- Original Message ----- From: "Michael J. Sinclair" <[email protected]>
To: "RBASE-L Mailing List" <[email protected]>
Sent: Saturday, October 31, 2009 1:58 PM
Subject: [RBASE-L] - Re: How do I check the data type of user entered data?


Thanks..I understand.
FWIW, this code is working pretty well...

SET V vslashchk = (SLOC(.vinput,'/'))
SET V vdashchk = (SLOC(.vinput,'-'))
SET V valphachk = (ISALPHA(.vinput))
SET V vdigitchk = (ISDIGIT(.vinput))
SET V vlengthchk = (SLEN(.vinput))
If vslashchk <> 0 OR vdashchk <> 0 AND vdigitchk = 1 THEN
 GOTO birthday
ENDIF
IF vslashchk = 0 and vdashchk = 0 and vlengthchk <= 6 THEN
 GOTO patnumbr
ENDIF
IF vslashchk = 0 and vdashchk = 0 and vlengthchk >= 7 and vdigitchk = 1 THEN
 GOTO phone
ENDIF
IF valphachk = 1 THEN
 GOTO lastname
ENDIF

Mike
-------------- Original message from "MikeB" <[email protected]>: --------------

That won't work. The "DataType" of TEXT is always going to be TEXT.

You would best follow Emmitt's suggestion in some way.

The only DataType that can hold multiple types of DataTypes is a Variant,
which we don't have.

It could be useful because it can hold Objects as well as data.

It would be unlikely this would come into mainstream RBase without
considerable (engine) effort.


----- Original Message ----- From: "Michael J. Sinclair"
To: "RBASE-L Mailing List"
Sent: Saturday, October 31, 2009 10:47 AM
Subject: [RBASE-L] - Re: How do I check the data type of user entered data?


> Do you think it would be useful to request an enhancement, ie a new
> function, perhaps something called DATATYPE
>
> (DATATYPE(text))
>
> Determines the type of data contained in text.
>
> In the following example, the value of vdatatype is DATE,
>
> SET VAR vdatatype = (DATATYPE('10/31/2009'))
>
>
> The way I have done it so far (not very elegant, but it works) is to
> assign the value of whatever the user typed in to a predetermined > variable
> with the data type set in advance, like this...
>
> SET V vdata TEXT
> FILLIN vdata USING 'Enter data'
> SET V vdate DATE
> SET V vdate = .vdata
> IF vdata IS NOT NULL THEN
> --ok, its a date, deal with it
> GOTO nextstep
> ENDIF
>
> SET V vnumber INTEGER
> SET V vnumber = .vdata
> IF vnumber is NOT NULL THEN
> --ok it is a number, deal with it
> GOTO nextstep
> ENDIF
>
> etc...
>
> Mike
> -------------- Original message from "MikeB"
> : -------------- >
>
>> > There is a function called CVTYPE you can use to determine data >> > type.
>>
>> That won't be of much help if the collection method is always of type
>> TEXT. Emmitt's approach will be the least troublesome / unwieldy to >> use
>> for
>> a universal search value emanating from a DIALOG.
>>
>> ----- Original Message ----- >> From: "jan johansen"
>> To: "RBASE-L Mailing List"
>> Sent: Saturday, October 31, 2009 9:06 AM
>> Subject: [RBASE-L] - Re: How do I check the data type of user entered
>> data?
>>
>>
>> > There is a function called CVTYPE you can use to determine data >> > type.
>> >
>> > What I did was to create a custom search form with a
>> > Variable Edit to contain the string to search for,
>> > Variable Radio Group to select what to search,
>> > and a Variable List View to display the search results.
>> >
>> > There is another pretty slick method to search all your desired
>> > columns but it is an example shown in the Super Advanced training.
>> > So I don't believe I am at liberty to share it. If Razzak wants to
>> > share it he can.
>> >
>> > Jan
>> >
>> >
>> >
>> > -----Original Message----- >> > From: mjsmd
>> > To: [email protected] (RBASE-L Mailing List)
>> > Date: Sat, 31 Oct 2009 08:11:47 -0400
>> > Subject: [RBASE-L] - How do I check the data type of user entered >> > data?
>> >
>> >
>> > Hi all,
>> > I want my user to be able to have the option of entering a birthday,
>> > last name, client ID (an integer less than 999999) or a phone number
>> > (a number greater than 1000000) in order to select the desired >> > client.
>> > What is the best way to determine the type of data that was entered?
>> > Is there a funtion that returns the data type?
>> >>
>> >
>>
>>
>


--------------------------------------------------------------------------------


Do you think it would be useful to request an enhancement, ie a new
function, perhaps something called DATATYPE

(DATATYPE(text))

Determines the type of data contained in text.

In the following example, the value of vdatatype is DATE,

SET VAR vdatatype = (DATATYPE('10/31/2009'))


The way I have done it so far (not very elegant, but it works) is to assign the value of whatever the user typed in to a predetermined variable with the
data type set in advance, like this...

SET V vdata TEXT
FILLIN vdata USING 'Enter data'
SET V vdate DATE
SET V vdate = .vdata
IF vdata IS NOT NULL THEN
--ok, its a date, deal with it
GOTO nextstep
ENDIF

SET V vnumber INTEGER
SET V vnumber = .vdata
IF vnumber is NOT NULL THEN
--ok it is a number, deal with it
GOTO nextstep
ENDIF

etc...

Mike
-------------- Original message from "MikeB"
: --------------

> > There is a function called CVTYPE you can use to determine data type.
>
> That won't be of much help if the collection method is always of type
> TEXT. Emmitt's approach will be the least troublesome / unwieldy to use
for
> a universal search value emanating from a DIALOG.
>
> ----- Original Message ----- > From: "jan johansen"
> To: "RBASE-L Mailing List"
> Sent: Saturday, October 31, 2009 9:06 AM
> Subject: [RBASE-L] - Re: How do I check the data type of user entered
data?
>
>
> > There is a function called CVTYPE you can use to determine data type.
> >
> > What I did was to create a custom search form with a
> > Variable Edit to contain the string to search for,
> > Variable Radio Group to select what to search,
> > and a Variable List View to display the search results.
> >
> > There is another pretty slick method to search all your desired
> > columns but it is an example shown in the Super Advanced training.
> > So I don't believe I am at liberty to share it. If Razzak wants to
> > share it he can.
> >
> > Jan
> >
> >
> >
> > -----Original Message----- > > From: mjsmd
> > To: [email protected] (RBASE-L Mailing List)
> > Date: Sat, 31 Oct 2009 08:11:47 -0400
> > Subject: [RBASE-L] - How do I check the data type of user entered
data?
> >
> >
> > Hi all,
> > I want my user to be able to have the option of entering a birthday,
> > last name, client ID (an integer less than 999999) or a phone number
> > (a number greater than 1000000) in order to select the desired > > client.
> > What is the best way to determine the type of data that was entered?
> > Is there a funtion that returns the data type?
> >>
> >
>
>





--------------------------------------------------------------------------------


Thanks..I understand.
FWIW, this code is working pretty well...

SET V vslashchk = (SLOC(.vinput,'/'))
SET V vdashchk = (SLOC(.vinput,'-'))
SET V valphachk = (ISALPHA(.vinput))
SET V vdigitchk = (ISDIGIT(.vinput))
SET V vlengthchk = (SLEN(.vinput))
If vslashchk <> 0 OR vdashchk <> 0 AND vdigitchk = 1 THEN
 GOTO birthday
ENDIF
IF vslashchk = 0 and vdashchk = 0 and vlengthchk <= 6 THEN
 GOTO patnumbr
ENDIF
IF vslashchk = 0 and vdashchk = 0 and vlengthchk >= 7 and vdigitchk = 1 THEN
 GOTO phone
ENDIF
IF valphachk = 1 THEN
 GOTO lastname
ENDIF

Mike
-------------- Original message from "MikeB" <[email protected]>: --------------

 > That won't work. The "DataType" of TEXT is always going to be TEXT.
 >
 > You would best follow Emmitt's suggestion in some way.
 >
> The only DataType that can hold multiple types of DataTypes is a Variant,
 > which we don't have.
 >
 > It could be useful because it can hold Objects as well as data.
 >
 > It would be unlikely this would come into mainstream RBase without
 > considerable (engine) effort.
 >
 >
> ----- Original Message ----- > From: "Michael J. Sinclair"
 > To: "RBASE-L Mailing List"
 > Sent: Saturday, October 31, 2009 10:47 AM
> Subject: [RBASE-L] - Re: How do I check the data type of user entered data?
 >
 >
 > > Do you think it would be useful to request an enhancement, ie a new
 > > function, perhaps something called DATATYPE
 > >
 > > (DATATYPE(text))
 > >
 > > Determines the type of data contained in text.
 > >
 > > In the following example, the value of vdatatype is DATE,
 > >
 > > SET VAR vdatatype = (DATATYPE('10/31/2009'))
 > >
 > >
 > > The way I have done it so far (not very elegant, but it works) is to
> > assign the value of whatever the user typed in to a predetermined variable
 > > with the data type set in advance, like this...
 > >
 > > SET V vdata TEXT
 > > FILLIN vdata USING 'Enter data'
 > > SET V vdate DATE
 > > SET V vdate = .vdata
 > > IF vdata IS NOT NULL THEN
 > > --ok, its a date, deal with it
 > > GOTO nextstep
 > > ENDIF
 > >
 > > SET V vnumber INTEGER
 > > SET V vnumber = .vdata
 > > IF vnumber is NOT NULL THEN
 > > --ok it is a number, deal with it
 > > GOTO nextstep
 > > ENDIF
 > >
 > > etc...
 > >
 > > Mike
 > > -------------- Original message from "MikeB"
> > : -------------- > >
 > >
> >> > There is a function called CVTYPE you can use to determine data type.
 > >>
 > >> That won't be of much help if the collection method is always of type
> >> TEXT. Emmitt's approach will be the least troublesome / unwieldy to use
 > >> for
 > >> a universal search value emanating from a DIALOG.
 > >>
> >> ----- Original Message ----- > >> From: "jan johansen"
 > >> To: "RBASE-L Mailing List"
 > >> Sent: Saturday, October 31, 2009 9:06 AM
 > >> Subject: [RBASE-L] - Re: How do I check the data type of user entered
 > >> data?
 > >>
 > >>
> >> > There is a function called CVTYPE you can use to determine data type.
 > >> >
 > >> > What I did was to create a custom search form with a
 > >> > Variable Edit to contain the string to search for,
 > >> > Variable Radio Group to select what to search,
 > >> > and a Variable List View to display the search results.
 > >> >
 > >> > There is another pretty slick method to search all your desired
 > >> > columns but it is an example shown in the Super Advanced training.
 > >> > So I don't believe I am at liberty to share it. If Razzak wants to
 > >> > share it he can.
 > >> >
 > >> > Jan
 > >> >
 > >> >
 > >> >
> >> > -----Original Message----- > >> > From: mjsmd
 > >> > To: [email protected] (RBASE-L Mailing List)
 > >> > Date: Sat, 31 Oct 2009 08:11:47 -0400
> >> > Subject: [RBASE-L] - How do I check the data type of user entered data?
 > >> >
 > >> >
 > >> > Hi all,
> >> > I want my user to be able to have the option of entering a birthday, > >> > last name, client ID (an integer less than 999999) or a phone number > >> > (a number greater than 1000000) in order to select the desired client. > >> > What is the best way to determine the type of data that was entered?
 > >> > Is there a funtion that returns the data type?
 > >> >>
 > >> >
 > >>
 > >>
 > >
 >
 >
 > 
--------------------------------------------------------------------------------
 >
 >
 > Do you think it would be useful to request an enhancement, ie a new
 > function, perhaps something called DATATYPE
 >
 > (DATATYPE(text))
 >
 > Determines the type of data contained in text.
 >
 > In the following example, the value of vdatatype is DATE,
 >
 > SET VAR vdatatype = (DATATYPE('10/31/2009'))
 >
 >
> The way I have done it so far (not very elegant, but it works) is to assign > the value of whatever the user typed in to a predetermined variable with the
 > data type set in advance, like this...
 >
 > SET V vdata TEXT
 > FILLIN vdata USING 'Enter data'
 > SET V vdate DATE
 > SET V vdate = .vdata
 > IF vdata IS NOT NULL THEN
 > --ok, its a date, deal with it
 > GOTO nextstep
 > ENDIF
 >
 > SET V vnumber INTEGER
 > SET V vnumber = .vdata
 > IF vnumber is NOT NULL THEN
 > --ok it is a number, deal with it
 > GOTO nextstep
 > ENDIF
 >
 > etc...
 >
 > Mike
 > -------------- Original message from "MikeB"
> : -------------- >
 >
> > > There is a function called CVTYPE you can use to determine data type.
 > >
 > > That won't be of much help if the collection method is always of type
> > TEXT. Emmitt's approach will be the least troublesome / unwieldy to use
 > for
 > > a universal search value emanating from a DIALOG.
 > >
> > ----- Original Message ----- > > From: "jan johansen"
 > > To: "RBASE-L Mailing List"
 > > Sent: Saturday, October 31, 2009 9:06 AM
 > > Subject: [RBASE-L] - Re: How do I check the data type of user entered
 > data?
 > >
 > >
> > > There is a function called CVTYPE you can use to determine data type.
 > > >
 > > > What I did was to create a custom search form with a
 > > > Variable Edit to contain the string to search for,
 > > > Variable Radio Group to select what to search,
 > > > and a Variable List View to display the search results.
 > > >
 > > > There is another pretty slick method to search all your desired
 > > > columns but it is an example shown in the Super Advanced training.
 > > > So I don't believe I am at liberty to share it. If Razzak wants to
 > > > share it he can.
 > > >
 > > > Jan
 > > >
 > > >
 > > >
> > > -----Original Message----- > > > From: mjsmd
 > > > To: [email protected] (RBASE-L Mailing List)
 > > > Date: Sat, 31 Oct 2009 08:11:47 -0400
 > > > Subject: [RBASE-L] - How do I check the data type of user entered
 > data?
 > > >
 > > >
 > > > Hi all,
 > > > I want my user to be able to have the option of entering a birthday,
 > > > last name, client ID (an integer less than 999999) or a phone number
> > > (a number greater than 1000000) in order to select the desired client.
 > > > What is the best way to determine the type of data that was entered?
 > > > Is there a funtion that returns the data type?
 > > >>
 > > >
 > >
 > >
 >
>

Reply via email to