show only related records with a date greater than today

Find out how to get things done with Servoy. Post how YOU get things done with Servoy

show only related records with a date greater than today

Postby gabid » Wed Jun 02, 2010 10:38 am

Hello guys
I'm trying to display a list of records based on a relationship, but only those that have a start_date greater than today.
I made a global variable vTodayMorning which I set to this morning:

Code: Select all
globals.vTodayMorning = new Date();
globals.vTodayMorning.setHours(0,0,0,0);


then I create a relationship where I select on the related table start_date >= globals.vTodayMorning, but it shows all records. What am I doing wrong?

Thanks
Gabriel
User avatar
gabid
 
Posts: 44
Joined: Fri Aug 15, 2008 10:25 am
Location: Craiova, Romania

Re: show only related records with a date greater than today

Postby pbakker » Wed Jun 02, 2010 11:00 am

This ought to work. Can you have a look at the query fired at the database?

Paul
pbakker
 
Posts: 2822
Joined: Wed Oct 01, 2003 8:12 pm
Location: Amsterdam, the Netherlands

Re: show only related records with a date greater than today

Postby gabid » Wed Jun 02, 2010 11:19 am

Thank you Paul for your answer. Is there a way to see the sent querry, other than sniffing on the connection?

Gabriel
User avatar
gabid
 
Posts: 44
Joined: Fri Aug 15, 2008 10:25 am
Location: Craiova, Romania

Re: show only related records with a date greater than today

Postby pbakker » Wed Jun 02, 2010 11:44 am

On the Servoy Admin pages you can see the queries in the Performance log

Paul
pbakker
 
Posts: 2822
Joined: Wed Oct 01, 2003 8:12 pm
Location: Amsterdam, the Netherlands

Re: show only related records with a date greater than today

Postby gabid » Wed Jun 02, 2010 12:05 pm

Silly me,
it was working, only that the comparison sign should have been the other way around. This is what happens when you do it in a hurry.

The global variable is, of course, on the left side of a relationship, so I should have said globals.vTodayMorning <= start_date.

Please close and delete this thread :D

Thanks,
Gabriel
User avatar
gabid
 
Posts: 44
Joined: Fri Aug 15, 2008 10:25 am
Location: Craiova, Romania


Return to How To

Who is online

Users browsing this forum: No registered users and 6 guests