Re: [Zope] left(string) equivalent

2000-06-16 Thread Rik Hoekstra

 

> 
> If it can't be done in the query, and I have to get the whole string in the
> sql method and slice it later, I can live with that, but then I have another
> problem: I let the wizard create a report for me and it gave me results that
> include:
> 
> 
>   
>   
> 
> 
> works fine.
> 
> so I changed "description" to "description[:4]" (no quotes, though).  If I
> try to view the report I get an error.

Uh, keep the quotes. description[:4] is a python expression.  is shorthand for ,
whereas  is shorthand for . Since you have no variable called
description[:4], this results in 

> 
> Error Type: KeyError
> Error Value: description[:4]
> 


Rik

___
Zope maillist  -  [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope-dev )




[Zope] left(string) equivalent

2000-06-15 Thread joel grimes

I should have given a little more detail.

I have an odbc connection and a zsqlmethod that work fine when the 
zsqlmethod says:

select description, datein
from san_jose

But I just want the first 4 characters of the description field.  So I've 
tried:

select substring(description, 1, 4), datein
from san_jose

I've also tried substr(), and some variations.  I even tried the Access 
version - left(description, 4).

If it can't be done in the query, and I have to get the whole string in the 
sql method and slice it later, I can live with that, but then I have another 
problem: I let the wizard create a report for me and it gave me results that 
include:


  
  


works fine.

so I changed "description" to "description[:4]" (no quotes, though).  If I 
try to view the report I get an error.

Error Type: KeyError
Error Value: description[:4]

Any ideas?

Thanks

Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com


___
Zope maillist  -  [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope-dev )