Thanks a lot , too late for testing this evening but I'll try the class solution as soon as possible. At the end , I'd like to select a duration time and splite the interval into regular interval of the selected duration (sorry for my bad english For example : Debut : 2010-01-01 Fin : 2010-12-31 Interval : 6 month #(= 0000-06-00 ?)
Then I will make a kind of loop : Debut(1) : 2010-01-01 Fin(1) :2010-06-01 Debut(2) :2010-06-02 Fin(2) :2010-12-31 something like: while debut(x)<Debut then debut(x)=debut+interval and so on So now I have two solution : I can catch a time type from form easily Or I make a substraction of two date types (using the class tip) to get my interval type. Thanks On 22 fév, 00:30, JmiXIII <[email protected]> wrote: > 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 > >

