Some suggestions, but I've not tested any of them:

1) Use timedelta(days=int(db.userCard.stage)) to convert your Field to int.

2) Split your query in 2 parts. The 2nd should use find() or exclude().

3) Use db.executesql() to insert your SQL statement.


--
Vinicius Assef



On 07/26/2012 12:23 PM, jw wrote:
Ok guys... I did step for step and now the query works for the stage
(progress).
The second thing (stage is multiplicator for time) I have no glue how to
move on.

cards2learn = db((db.groupCards.card_id == db.card.id) \
         & (db.groupCards.studyGroup_id == auth.user.studyGroup_id) \
         & (session.chosenSubject_id == db.card.subject_id) \
         & (db.userCard.card_id == db.card.id)
         & (db.userCard.stage <= 5) \
         & (db.userCard.lastTimeLearned < (date.today() -
timedelta(days=(1))))
         ).select(db.userCard.ALL,db.card.ALL,db.groupCards.ALL,
left=db.userCard.on((db.userCard.card_id == db.card.id)))

timedelta(days=(1)) should be timedelta(days=(db.userCard.stage)) but it
says:


        <type 'exceptions.TypeError'> unsupported type for timedelta
        days component: Field


How do I use the db.userCard.stage in timedelta (stage is an integer
field in the table)?

Many thanks for the previous answers!

--




--



Reply via email to