Main   Products   Offshore Outsourcing   Customers   Partners   ContactUs  
JDBC Databases
  HXTT Access v5.2
  HXTT Cobol v2.1
  HXTT DBF v5.2
  HXTT Excel v4.2
  HXTT Paradox v5.2
  HXTT Text(CSV) v5.2
 
  Buy Now
  Support
  Download
  Document
  FAQ
  HXTT XML v1.2
Offshore Outsourcing
Oracle Data Import/Export
DB2 Data Import/Export
Sybase Data Import/Export
Free Resources
  Firewall Tunneling
  Search Indexing Robot
  Conditional Compilation
  Password Recovery for MS Access
  Password Recovery for Corel Paradox
  Checksum Tool for MD5
  Character Set Converter
  Pyramid - Poker of ZYH
   
   
   
Hongxin Technology & Trade Ltd. of Xiangtan City (abbr, HXTT)

HXTT Text(CSV)
Dirty data
Mark
2006-09-27 13:07:28.0
I have some data I need to process, but there is no guarantee it will be valid for integer and double types (e.g. sometimes there will be alpha characters in an integer column). So in the schema I will treat these as varchar. What I want to do is use SQL functions to convert it to the right type if its valid. The problem is, I don't see the right functions for what I want. I would like something like IF(ISDIGIT(field),CINT(field),NULL)) but ISDIGIT only tests the leftmost character.. I want all the characters tested.

Thanks,
Mark
Re:Dirty data
HXTT Support
2006-09-27 20:46:26.0
Now you can use IF(ISDIGITS(field),CINT(field),NULL)) . ISDIGITS, not ISDIGIT:) Please download the latest package.
Re:Re:Dirty data
Mark
2006-09-27 21:37:32.0
Thanks for implementing this.. I think its a very useful feature for dealing with dirty input data -- which is what you find when dealing with text files.

What I forgot to mention before, is that sometimes I may be dealing with floating point data as well. So I think what I also need would be the following in terms of a regex: [-+]?[0-9]+(\.[0-9]+)?
maybe call it isNumber? I hope I am not asking for too much. Thanks for your support.

Regards,
Mark
Re:Re:Re:Dirty data
HXTT Support
2006-09-27 23:28:20.0
GetNumber(str[, defaultValue]): return a number value(int, long, double) according to str. If failed to parse, return defaultValue(null is omitted value).
GetInt(str[, defaultValue]): return an int value according to str. If failed to parse, return defaultValue(null is omitted value).
GetLong(str[, defaultValue]): return a long value according to str. If failed to parse, return defaultValue(null is omitted value).
GetDouble(str[, defaultValue]): return a double value according to str. If failed to parse, return defaultValue(null is omitted value).

GetNumber is a special function, which allows defaultValue to use non-number value. For instance,
select getNumber(field,field),...
Object value=resultSet.getObject(1);
if(value instance Number){//Parsed number, Integer, Double, or Double
}else{
value=restultSet.getString(1);//Now you can see the invalid data format.
}

Please download the latest package.
Re:Re:Re:Re:Dirty data
Mark Diamond
2006-09-28 10:11:02.0
Thank you. I will test it.

I just want to say that this feature (GetNumber,etc) is still very helpful eventhough you have implemented: http://www.hxtt.com/support_view_issue.jsp?id=1159435932
The reason is that some users may want complete control of dealing with dirty data and do some custom workaround vs. having the driver return a null.

Thanks,
Mark


Search Key   Search by Last 50 Questions




Google
 

Address: 9 Station Rd., Xiangtan City, Hunan Province, P.R. China
Postcode: 411100
Phone: (86)731-58225727
Fax: (86)731-58225727
Email: webmaster@hxtt.com
Copyright © 1999-2011 Hongxin Technology & Trade Ltd. | All Rights Reserved. | Privacy | Legal | Sitemap