1. EUGrid formatting

This is a multi-part message in MIME format.

------=_NextPart_000_0035_01C3AABC.C620FC90
	charset="iso-8859-1"

I am using Sqllite with EUGrid and having a problem inserting data from the Grid
to SQLite.I can insert the data, but it stores funny, It is a number field.
SQLite stores dat with single quotes. I am not sure if I am using the numeric 
Grid controls.
I have used these formats I changed the "%-0d" to "%-d". I get a single digit
stored into an Sqlite field.
Jvandal
=============================================
void = EGW_SetColumnProperty(Grid, ColNumber, EGW_COL_NUMFORMAT, "%-d")
void = EGW_SetColumnProperty(Grid, ColAmount, EGW_COL_DATATYPE, EGW_NUMBER)

------=_NextPart_000_0035_01C3AABC.C620FC90
Content-Type: text/html;
	charset="iso-8859-1"
Content-Transfer-Encoding: 8bit

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<META content="MSHTML 6.00.2800.1276" name=GENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=#ffffff>
<DIV><FONT face=Arial size=2>I am using Sqllite with EUGrid and having a problem
inserting data from the Grid to SQLite.I can insert the data, but it stores 
funny, It is a number field.&nbsp;SQLite stores dat with single quotes. I am not
sure if I am using the numeric&nbsp; Grid controls. </FONT></DIV>
<DIV><FONT face=Arial size=2>I have used these formats I changed the "%-0d" to 
"%-d". I get a single digit stored into an Sqlite field.</FONT></DIV>
<DIV><FONT face=Arial size=2>Jvandal</FONT></DIV>
<DIV><FONT face=Arial 
size=2>=============================================</FONT></DIV>
<DIV><FONT face=Arial size=2>void = EGW_SetColumnProperty(Grid, ColNumber, 
EGW_COL_NUMFORMAT, "%-d")<BR>void = EGW_SetColumnProperty(Grid, ColAmount, 

------=_NextPart_000_0035_01C3AABC.C620FC90--

new topic     » topic index » view message » categorize

2. Re: EUGrid formatting

Phil, I hope this is the code you requested. It is code from Noah converted.
I haven't put any delete or add functions as yet.
 I will appreciate any advice.
Jim
============================= code from Noah.exw=============
ColStock = EGW_AddColumn(Grid, "ID", 50, EGW_LAST, EGW_EDIT, STOCK ),
ColName = EGW_AddColumn(Grid, "Company", 150, EGW_LAST, EGW_EDIT, NAME ),
ColDate  = EGW_AddColumn(Grid, "Date", 50, EGW_LAST, EGW_EDIT, DATE ),
ColNumber = EGW_AddColumn(Grid, "No", 50, EGW_LAST, EGW_EDIT, NUMBER ),
ColAmount = EGW_AddColumn(Grid, "Amount", 50, EGW_LAST, EGW_EDIT, AMOUNT )
-- Set grid attributes
void = EGW_SetGridProperty(Grid, EGW_LINE_COLOR, Black)
void = EGW_SetGridProperty(Grid, EGW_CELL_BORDER_COLOR, Black)
void = EGW_SetGridProperty(Grid, EGW_NUMBER_FORMAT, "%0d")
void = EGW_SetGridProperty(Grid, EGW_HIGHLIGHT_TEXT, EGW_True)

-- Set column attributes
void = EGW_SetColumnProperty(Grid, ColStock, EGW_COL_ALIGN, EGW_LEFT)
void = EGW_SetColumnProperty(Grid, ColName, EGW_COL_ALIGN, EGW_LEFT)
void = EGW_SetColumnProperty(Grid, ColDate, EGW_COL_ALIGN, EGW_RIGHT )
void = EGW_SetColumnProperty(Grid, ColNumber, EGW_COL_ALIGN, EGW_RIGHT )
void = EGW_SetColumnProperty(Grid, ColAmount, EGW_COL_ALIGN, EGW_RIGHT )
--void = EGW_SetColumnProperty(grid6, grid6col2, EGW_COL_DATATYPE,
EGW_NUMBER)
-- Date of Birth column, editable + right aligned
--coldob = EGW_AddColumn( grid1, "DOB", 100, EGW_LAST, EGW_EDIT, 2 )
--void   = EGW_SetColumnProperty( grid1, coldob, EGW_COL_ALIGN, EGW_RIGHT )
--*------------------------------------------------------*
Noah.e ++++++++++++++++++++++++++++++++++++++
global function SaveStockData( sequence record )
 atom recno
 object newkey, bret
 sequence db_record
 trace(2)
 bret=False
 -- Set up database record
-- db_record = EmptyDBRecord
-- db_record[Stock] = record[Stock]
-- db_record[NUMBER] = record[NUMBER]
-- db_record[NOTES] = record[NOTES]
 stockID = record[STOCK]
 --amt = record[AMOUNT]
 number   = record[NUMBER]
-- number = s2n(snumber)
-- ""&sprintf("%d", f11)&"," &
  -- Try and find key in table
 cmd = "UPDATE StockIDTable set "&
        "no = '"&number&"'" &
        "   WHERE IDKKey  ='" &stockID& "';"
 data = sqlite_get_table(sql_db, cmd)
 if sqlite_last_err_no != SQLITE_OK then
   printf(2, "%s = %s\n", {"record","Not a valid stock ID"})

 end if
 return bret

end function
----- Original Message ----- 
From: "Phil Russell" <pg_russell at lineone.net>
To: <EUforum at topica.com>
Sent: Friday, November 14, 2003 4:20 PM
Subject: RE: EUGrid formatting


>
>
> Hi,
>
> If you specify a column property of EGW_NUMBER then the value is held
> internally as an atom, with any formatting only being applied when the
> cell is displayed i.e. the formatting should not be relevant.
>
> To help answer your questiom, could you post the following code:
>
> 1. The code you are using to extract the value from the grid.
> 2. The code you are using to write the value to SQLite.
>
> Regards,
>
> Phil
>
>
> sixs wrote:
> > I am using Sqllite with EUGrid and having a problem inserting data from
> > the Grid to SQLite.I can insert the data, but it stores funny, It is a
> > number field. SQLite stores dat with single quotes. I am not sure if I
> > am using the numeric  Grid controls.
> > I have used these formats I changed the "%-0d" to "%-d". I get a single
> > digit stored into an Sqlite field.
> > Jvandal
> > =============================================
> > void = EGW_SetColumnProperty(Grid, ColNumber, EGW_COL_NUMFORMAT, "%-d")
> > void = EGW_SetColumnProperty(Grid, ColAmount, EGW_COL_DATATYPE,
> > EGW_NUMBER)
> >
>
>
>
> TOPICA - Start your own email discussion group. FREE!
>
>

new topic     » goto parent     » topic index » view message » categorize

3. Re: EUGrid formatting

Phil,
Sqlite doesn't care about numbers. This is a quote from Sqlite FAQ,
"
(2) SQLite lets me insert a string into a database column of type integer!

  This is a feature, not a bug. SQLite is typeless. Any data can be inserted
into any column. You can put arbitrary length strings into integer columns,
floating point numbers in boolean columns, or dates in character columns.
The datatype you assign to a column in the CREATE TABLE command is (mostly)
ignored. Every column is able to hold an arbitrary length string. (There is
one exception: Columns of type INTEGER PRIMARY KEY may only hold an integer.
An error will result if you try to put anything other than an integer into
an INTEGER PRIMARY KEY column.)

  Because SQLite ignores data types, you can omit the data type definition
from columns in CREATE TABLE statements. ----- Original Message ----- 

  The questrion seems to be of putting a single quote value into SQLite and
then retrieving it and converting it to EUGrid number format.



  Jim.

From: "Phil Russell" <pg_russell at lineone.net>
To: <EUforum at topica.com>
Sent: Saturday, November 15, 2003 1:01 PM
Subject: RE: EUGrid formatting


>
>
> Jim,
>
> It looks to me like the problem is in the construction of your SQL
> statement:
>
> -- Try and find key in table
> cmd = "UPDATE StockIDTable set "&
>         "no = '"&number&"'" &
>         "   WHERE IDKKey ='" &stockID& "';"
>
> Assuming e.g. number=123 and stockID=789 then this would build a string
> like:
>
> UPDATE StockIDTable set no = '123' WHERE IDKKey ='789';
>
> If the columns you are using are numeric then I don't think that you
> should include the single quotes around the number values i.e. your SQL
> should be:
>
> UPDATE StockIDTable set no = 123 WHERE IDKKey = 789;
>
> I suggest you try modifying your code to something like:
>
> cmd = "UPDATE StockIDTable set " &
>         "no = " & sprintf("%0d", number) &
>         "   WHERE IDKKey =" & sprintf("%0d", stockID) & ";"
>
> NB I haven't actually tried this!
>
> HTH,
>
> Phil
>
> sixs wrote:
> >
> >
> > Phil, I hope this is the code you requested. It is code from Noah
> > converted.
> > I haven't put any delete or add functions as yet.
> >  I will appreciate any advice.
> > Jim
> > ============================= code from Noah.exw=============
> > ColStock = EGW_AddColumn(Grid, "ID", 50, EGW_LAST, EGW_EDIT, STOCK ),
> > ColName = EGW_AddColumn(Grid, "Company", 150, EGW_LAST, EGW_EDIT, NAME
> > ),
> > ColDate  = EGW_AddColumn(Grid, "Date", 50, EGW_LAST, EGW_EDIT, DATE ),
> > ColNumber = EGW_AddColumn(Grid, "No", 50, EGW_LAST, EGW_EDIT, NUMBER ),
> > ColAmount = EGW_AddColumn(Grid, "Amount", 50, EGW_LAST, EGW_EDIT, AMOUNT
> > )
> > -- Set grid attributes
> > void = EGW_SetGridProperty(Grid, EGW_LINE_COLOR, Black)
> > void = EGW_SetGridProperty(Grid, EGW_CELL_BORDER_COLOR, Black)
> > void = EGW_SetGridProperty(Grid, EGW_NUMBER_FORMAT, "%0d")
> > void = EGW_SetGridProperty(Grid, EGW_HIGHLIGHT_TEXT, EGW_True)
> >
> > -- Set column attributes
> > void = EGW_SetColumnProperty(Grid, ColStock, EGW_COL_ALIGN, EGW_LEFT)
> > void = EGW_SetColumnProperty(Grid, ColName, EGW_COL_ALIGN, EGW_LEFT)
> > void = EGW_SetColumnProperty(Grid, ColDate, EGW_COL_ALIGN, EGW_RIGHT )
> > void = EGW_SetColumnProperty(Grid, ColNumber, EGW_COL_ALIGN, EGW_RIGHT )
> > void = EGW_SetColumnProperty(Grid, ColAmount, EGW_COL_ALIGN, EGW_RIGHT )
> > --void = EGW_SetColumnProperty(grid6, grid6col2, EGW_COL_DATATYPE,
> > EGW_NUMBER)
> > -- Date of Birth column, editable + right aligned
> > --coldob = EGW_AddColumn( grid1, "DOB", 100, EGW_LAST, EGW_EDIT, 2 )
> > --void   = EGW_SetColumnProperty( grid1, coldob, EGW_COL_ALIGN,
> > EGW_RIGHT )
> > --*------------------------------------------------------*
> > Noah.e ++++++++++++++++++++++++++++++++++++++
> > global function SaveStockData( sequence record )
> >  atom recno
> >  object newkey, bret
> >  sequence db_record
> >  trace(2)
> >  bret=False
> >  -- Set up database record
> > -- db_record = EmptyDBRecord
> > -- db_record[Stock] = record[Stock]
> > -- db_record[NUMBER] = record[NUMBER]
> > -- db_record[NOTES] = record[NOTES]
> >  stockID = record[STOCK]
> >  --amt = record[AMOUNT]
> >  number   = record[NUMBER]
> > -- number = s2n(snumber)
> > -- ""&sprintf("%d", f11)&"," &
> >   -- Try and find key in table
> >  cmd = "UPDATE StockIDTable set "&
> >         "no = '"&number&"'" &
> >         "   WHERE IDKKey  ='" &stockID& "';"
> >  data = sqlite_get_table(sql_db, cmd)
> >  if sqlite_last_err_no != SQLITE_OK then
> >    printf(2, "%s = %s\n", {"record","Not a valid stock ID"})
> >
> >  end if
> >  return bret
> >
> > end function
> > ----- Original Message ----- 
> > From: "Phil Russell" <pg_russell at lineone.net>
<snip>

> > > > the Grid to SQLite.I can insert the data, but it stores funny, It is
a
> > > > number field. SQLite stores dat with single quotes. I am not sure if
I
> > > > am using the numeric  Grid controls.
> > > > I have used these formats I changed the "%-0d" to "%-d". I get a
single
> > > > digit stored into an Sqlite field.
> > > > Jvandal
> > > > =============================================
> > > > void = EGW_SetColumnProperty(Grid, ColNumber, EGW_COL_NUMFORMAT,
"%-d")
> > > > void = EGW_SetColumnProperty(Grid, ColAmount, EGW_COL_DATATYPE,
> > > > EGW_NUMBER)
> <snip>
>
>
>
> TOPICA - Start your own email discussion group. FREE!
>
>

new topic     » goto parent     » topic index » view message » categorize

4. Re: EUGrid formatting

Phil,
Thanks for answering. a final questyion. are you using Euphoria wih Oracle?
Jim
----- Original Message ----- 
From: "Phil Russell" <pg_russell at lineone.net>
To: <EUforum at topica.com>
Subject: RE: EUGrid formatting


>
>
> Jim,
>
> I don't know much about SQLite I'm afraid - I am an Oracle programmer by
> trade.
>
> Part of what I was saying is that there is *no* EuGrid number format -
> numbers are held internally as plain old atoms.  They are only formatted
> for display on the screen and this does *not* affect the underlying
> value.
>
> If you extract the value of a cell with a numeric value in in (with e.g.
> EGW_GetDataCellValue) then you will just get an atom back. Similarly, if
> you add a numeric value to a cell then you just pass in an atom.
>
> The problem therefore, is one of conversion from:
>
> atom -> SQLite format (when writing to db)
> SQLite format -> atom (when reading from db, before adding to grid)
>
> i.e. EuGrid is irrelevant to this process.
>
> I still don't understand why you are enclosing your numbers in quotes
> when you pass them to the db.  Surely the db will interpret that as a
> string? Another question is whether SQLite can tell what *sort* of data
> is in a given row/column e.g. number, string etc, given that it will
> hold any type of data.
>
> Perhaps there is a SQLite guru in the forum who could help?
>
> Regards,
>
> Phil
>
>
> sixs wrote:
> >
> >
> > Phil,
> > Sqlite doesn't care about numbers. This is a quote from Sqlite FAQ,
> > "
> > (2) SQLite lets me insert a string into a database column of type
> > integer!
> >
> >   This is a feature, not a bug. SQLite is typeless. Any data can be
> >   inserted
> > into any column. You can put arbitrary length strings into integer
> > columns,
> > floating point numbers in boolean columns, or dates in character
> > columns.
> > The datatype you assign to a column in the CREATE TABLE command is
> > (mostly)
> > ignored. Every column is able to hold an arbitrary length string. (There
> > is
> > one exception: Columns of type INTEGER PRIMARY KEY may only hold an
> > integer.
> > An error will result if you try to put anything other than an integer
> > into
> > an INTEGER PRIMARY KEY column.)
> >
> >   Because SQLite ignores data types, you can omit the data type
definition
> > from columns in CREATE TABLE statements. ----- Original Message ----- 
> >
> >   The questrion seems to be of putting a single quote value into SQLite
> >   and
> > then retrieving it and converting it to EUGrid number format.
> >
> >
> >   Jim.
> >
>
>
>
> TOPICA - Start your own email discussion group. FREE!
>
>

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu