Data Conversion Error

Robert J.M. Edis Robert.Edis@creatcomp.com
Fri, 29 Jan 1999 15:06:24 -0500


>From the original message the data type of the field must be alpha-numeric.
Therefore the code should be:

	item new_field = NCONVERT(incoming_field)  &
	  if incoming_field >= "-999999" and incoming_field <=  "999999"
else 0

But, is the data right or left justified? Zero or blank filled? What happens
if the data value is 9AB31?

The solution is not really that easy programmatically.  You should really
purge the records of the non-numeric data first and make sure it is either
all left justified or zero filled.  It could mean testing each byte for a
numeric character first.  E.g.

DEFINE d_digits CHAR*10 = "0123456789"
DEFINE d_nonnum CHAR*01 = "T" &
  IF 0 EQ INDEX(d_digits,incoming_field[1]) &
  OR 0 EQ INDEX(d_digits,incoming_field[2]) &
  ...
  ELSE "F"
ITEM new_field = NCONVERT(incoming_field)   &
  IF d_nonnum NE "T" ELSE 0

Blue
PowerHouse consultant
Rhode Island, USA

Disclaimer:
The opinions and ideas expressed in this message are my own and have no
relationship to my current employer, Initial Technical Staffing, its client
CCI, or any of CCI's clients.



	-----Original Message-----
	From:	Oran Shapitka [SMTP:oran@intertechsystems.com]
	Sent:	Friday, January 29, 1999 2:44 PM
	To:	Cindy Lomas; powerh-l@lists.swau.edu
	Subject:	RE: Data Conversion Error

	Use an IF structure to test to value of the incoming field.  If it
is
	non-numeric, assign a value of zero, otherwise use the value from
the
	incoming field.

	Example:

	item new_field =    &
	  incoming_field  if incoming_field >= -999999 and   &
	                     incoming_field <=  999999  else &
	  0

	Note set your 99999's to the size of the incoming field.


	Oran Shapitka, ISP
	Intertech Business Systems, Inc.
	1564, 10303 Jasper Ave
	Edmonton, AB  T5J 3N6  Canada

	Email:	oran@intertechsystems.com
	Voice:	(780) 413-0400
	Fax:		(780) 413-0398


	> -----Original Message-----
	> From: owner-powerh-l@sphere.swau.edu
	> [mailto:owner-powerh-l@sphere.swau.edu]On Behalf Of Cindy Lomas
	> Sent: Friday, January 29, 1999 11:41 AM
	> To: powerh-l@lists.swau.edu
	> Subject: Data Conversion Error
	>
	>
	>
	> I am attempting to use QTP to initialize a numeric data item that
contains
	> non-numeric data. Some of the records contain valid numeric data
in the
	> field where others (1000's) do not. How do I initialize only the
fields
	> that are not numeric? I keep getting a data conversion error.
	>
	> Can anyone help?
	>
	> Cindy Lomas
	> Dairy Farmers of Ontario
	> Supervisor, Systems Development
	> clomas@milk.org
	> = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
	> = = = = =
	> Subscribe: "subscribe powerh-l" in message body to
	> majordomo@lists.swau.edu
	> Unsubscribe: "unsubscribe powerh-l" in message to
majordomo@lists.swau.edu
	> powerh-l@lists.swau.edu is gatewayed one-way to
bit.listserv.powerh-l
	> This list is closed, thus to post to the list, you must be a
subscriber.
	>

	= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
= = = =
	Subscribe: "subscribe powerh-l" in message body to
majordomo@lists.swau.edu
	Unsubscribe: "unsubscribe powerh-l" in message to
majordomo@lists.swau.edu
	powerh-l@lists.swau.edu is gatewayed one-way to
bit.listserv.powerh-l
	This list is closed, thus to post to the list, you must be a
subscriber.
= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
Subscribe: "subscribe powerh-l" in message body to majordomo@lists.swau.edu
Unsubscribe: "unsubscribe powerh-l" in message to majordomo@lists.swau.edu
powerh-l@lists.swau.edu is gatewayed one-way to bit.listserv.powerh-l
This list is closed, thus to post to the list, you must be a subscriber.