Ooops sorry I did not see the answers

On 22 fév, 00:29, JmiXIII <[email protected]> wrote:
> simpler :
>
> Does somebody know how I could transform a field passed via FORM in a
> datetime dal compliant field ?
> Thanks a lot ...
>
> On 21 fév, 21:56, JmiXIII <[email protected]> wrote:
>
> > I need to split a date range into shorter intervalle :
>
> >     Selection=FORM(TABLE(TR(
> >     (TD("De l'article",SELECT(_name='DebArt',
> > *[OPTION(ListeArticle[i].CodeArticle,
> > _value=str(ListeArticle[i].CodeArticle)) for i in
> > range(len(ListeArticle))]))),
> >      TD("A
> > l'article",SELECT(_name='FinArt',*[OPTION(ListeArticle[i].CodeArticle,
> > _value=str(ListeArticle[i].CodeArticle)) for i in
> > range(len(ListeArticle))])),
> >      TD("Sélectionner
> > aussi",SELECT(_name='PluArt',_multiple='multiple',
> > *[OPTION(ListeArticle[i].CodeArticle,
> > _value=str(ListeArticle[i].CodeArticle)) for i in
> > range(len(ListeArticle))])),
> >      TD("Exclure les
> > articles",SELECT(_name='NonArt',_multiple='multiple',
> > *[OPTION(ListeArticle[i].CodeArticle,
> > _value=str(ListeArticle[i].CodeArticle)) for i in
> > range(len(ListeArticle))])),
> >      TD("De la date (AAAA-MM-JJ)", INPUT(_name='Debut', requires =
> > IS_DATE(error_message=T('Doit être de la forme AAAA-MM-JJ !')))),
> >      TD("A la date (AAAA-MM-JJ)", INPUT(_name='Fin',requires =
> > IS_DATE(error_message=T('Doit être de la forme AAAA-MM-JJ !')))),
> >      TD("Interval (AAAA-MM-JJ)", INPUT(_name='Interval', requires =
> > IS_DATE(error_message=T('Doit être de la forme AAAA-MM-JJ !')))),
> >      TD("Sélectionner",
> > INPUT(_type='submit',_value='Sélectionner')))))
>
> >     if Selection.accepts(request.vars,keepvalues=True):
> >         pass
>
> >     DebArt=request.vars.DebArt
> >     Debut=request.vars.Debut
> >     Fin=request.vars.Fin
> >     FinArt=request.vars.FinArt
> >     NonArt=request.vars.NonArt
> >     PluArt=request.vars.PluArt
> >     Interval=request.vars.Interval
> >     try:
> >         Inter=Fin-Interval
> >     except:
> >         Inter=""
>
> > As you can see I first tried to get an intervalle by the substraction
> > of two request.vars., just to figure id it can works but as expecteed
> > it does not work since Fin and Inter are string types.
>
> > Fortunately it works with my sqlite type and i can write things like :
> > query=db.table.date>=Debut
> > it works sucessfully
>
> > Yet for splitting the range [Debut-Fin] into many regular shorter
> > intervals, the pb is I don't know how to catch Date type value from
> > the form that will work with the datetime type of dal ....
>
> > If someone can give me an idea .....
> > Thanks
>
>

Reply via email to