Load data based on current date

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

Load data based on current date

Postby mskv1309 » Thu Oct 11, 2012 6:35 pm

I am working on form that need to load all data for today date only.
I have created relationships between tables bound all text fields with respective column in table.

On Show event I want to load all records that are for today date and untill current time.

how can I pass parameter to foundset.loadrecord()
mskv1309
 
Posts: 41
Joined: Thu Apr 26, 2012 10:05 pm

Re: Load data based on current date

Postby jdbruijn » Fri Oct 12, 2012 8:48 am

You could use a foundsetfilter:
Code: Select all
var vToday = utils.dateFormat(new Date(), 'yyyy-MM-dd')
foundset.addFoundSetFilterParam('date_field', '>=', vToday, 'todayFilter')
Jos de Bruijn
Focus Feedback BV
Servoy Certified Developer
Image
jdbruijn
 
Posts: 492
Joined: Sun Apr 11, 2010 6:34 pm

Re: Load data based on current date

Postby jgarfield » Sat Oct 13, 2012 6:56 pm

mskv1309 wrote:how can I pass parameter to foundset.loadrecord()


Code: Select all
//foundset.loadRecords(query, queryArguments)

//e.g.
var dToday = new Date();
dToday.setHours(0, 0, 0, 0);
var dNow = new Date();
foundset.loadRecords("SELECT table.primarykey FROM table WHERE datecolumn >= ? AND datecolumn <= ?", [dToday, dNow]);

//or this might work for you too
foundset.loadRecords("SELECT table.primarykey FROM table WHERE datecolumn >= TODAY() AND datecolumn <= NOW()", []);
Programmer.
adBlocks
http://www.adblocks.com
jgarfield
 
Posts: 223
Joined: Wed Sep 28, 2005 9:02 pm
Location: Boston, US

Re: Load data based on current date

Postby mskv1309 » Mon Oct 15, 2012 3:12 pm

Thanks Jdruijn & jgarfield.
mskv1309
 
Posts: 41
Joined: Thu Apr 26, 2012 10:05 pm


Return to How To

Who is online

Users browsing this forum: No registered users and 8 guests