[Zope] left(string) equivalent

Rik Hoekstra rik.hoekstra@inghist.nl
Fri, 16 Jun 2000 10:21:27 +0200


<snip sql questions I can't answer> 

> 
> 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:
> 
> <tr>
>   <td><dtml-var description null=""></td>
>   <td><dtml-var datein null=""></td>
> </tr>
> 
> 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. <dtml-var
"description[:4]"> is shorthand for <dtml-var expr="description[:4]">,
whereas <dtml-var description[:4]> is shorthand for <dtml-var
name="description[:4]">. Since you have no variable called
description[:4], this results in 

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


Rik