No worries :)
Just to recap this isn't a database issue it's a Witango issue with the Format attribute giving an error when trying to convert 350,000 to 350000 (without the thousands separator) using FORMAT="num:simple-integer".
Stefan and Scott's suggestions seem to work, thanks guys.
If anyone know's why the above format attribute kicks the error I would greatly appreciate some enlightenment.
B
On Thursday, September 4, 2003, at 05:19 PM, Scott Cadillac wrote:
My apologies Bryan,
I think I got your question backwards - second time I did that today (an
off-line conversation) :-P
I read a great quote earlier today "What we need is a fountain of smart --
we've got enough youth..." - thanks David Thomas. This certainly applies to
me today - I guess I was too late last night working....
Anyway, "removing" formatting is something that doesn't come up to often,
but Stefan's suggestion earlier is a good one:
<@keep @@mynumber "0123456789">
The example in the documentation doesn't specifically show how it deals with
thousand separators, so it's hard to tell how it's meant to work in this
case.
As well, it appears the FORMAT="num:simple-integer" doesn't account for
rounding, so you could also get the equivalent by doing something like the
following:
<@CALC EXPR='floor(<@VAR local$mynumber>)'>
Hope this helps. Cheers....
Scott Cadillac, Witango.org - http://witango.org 403-281-6090 - [EMAIL PROTECTED] -- Information for the Witango Developer Community ---------------------
XML-Extranet - http://xmlx.ca 403-281-6090 - [EMAIL PROTECTED] -- Well-formed Development (for hire) ---------------------
-----Original Message----- From: Bryan Hughes [mailto:[EMAIL PROTECTED] Sent: Thursday, September 04, 2003 2:43 PM To: [EMAIL PROTECTED] Subject: Re: Witango-Talk: Format NUM
Scott,
The database is MySQL with the column datatype of bigint.
The insert statement is UNquoted since it is not a string. Yes there is a database problem, but I'm trying to prevent that problem with the format attribute that isn't working.
I am familiar with databases and datatypes and how to properly insert data into them. I'm using Witango to properly format that data but it doesn't seem to be working as documented.
I'm needing to format the number into an INTEGER which is what I thought "num:simple-integer" should do.
Any ideas as to why Witango isn't formatting and giving an error?
-B
On Thursday, September 4, 2003, at 03:22 PM, Scott Cadillac wrote:
Hi Bryan,but you
Your error message sounds like something from the database,storage of thedidn't mention what kind you have.
For healthy database storage purposes, don't store your number with pretty-printed formatting.
Most databases will use a different format for the rawa propervalue then what you often see from your database GUI manager. This is especially true for "datetime" fields.
If the field is a "number" type of some kind, then feed itnumber valuenumber. As far as most databases are concerned, a value like 350,000 is a string so it'll complain.
As well, SQL doesn't typically use quotes for number values (SQL generated by Witango or otherwise), so having a comma present in ayou won'twill likely break your SQL statement.
Apply the formatting on the read from the database, something like:
<@COLUMN "table.field" FORMAT="num:simple-integer">
Or use a "text" type field for storing your value, but thencomma in thebe able to query the field like a true number anymore.
Hope this helps. Cheers.....
Scott Cadillac, Witango.org - http://witango.org 403-281-6090 - [EMAIL PROTECTED] -- Information for the Witango Developer Community ---------------------
XML-Extranet - http://xmlx.ca 403-281-6090 - [EMAIL PROTECTED] -- Well-formed Development (for hire) ---------------------
-----Original Message----- From: Bryan Hughes [mailto:[EMAIL PROTECTED] Sent: Thursday, September 04, 2003 12:51 PM To: [EMAIL PROTECTED] Subject: Witango-Talk: Format NUM
I'm trying to format a number before insert into a database.
The input number would be something like "350,000".
<@VAR mynumber FORMAT="num:simple-integer">
But getting an error on execution: input text not valid, text not formatted.
And the database action is getting an error because theformatted" mean,numbers throws off the number columns in the insert.
What does the error "input text not valid, text notwhat's causing it.
______________________________________________________________ __________ TO UNSUBSCRIBE: Go to http://www.witango.com/maillist.taf
______________________________________________________________ __________ TO UNSUBSCRIBE: Go to http://www.witango.com/maillist.taf
______________________________________________________________ __________ TO UNSUBSCRIBE: Go to http://www.witango.com/maillist.taf
_______________________________________________________________________ _
TO UNSUBSCRIBE: Go to http://www.witango.com/maillist.taf
________________________________________________________________________ TO UNSUBSCRIBE: Go to http://www.witango.com/maillist.taf
