Page 1 of 1

Load data based on current date

PostPosted: Thu Oct 11, 2012 6:35 pm
by mskv1309
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()

Re: Load data based on current date

PostPosted: Fri Oct 12, 2012 8:48 am
by jdbruijn
You could use a foundsetfilter:
Code: Select all
var vToday = utils.dateFormat(new Date(), 'yyyy-MM-dd')
foundset.addFoundSetFilterParam('date_field', '>=', vToday, 'todayFilter')

Re: Load data based on current date

PostPosted: Sat Oct 13, 2012 6:56 pm
by jgarfield
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()", []);

Re: Load data based on current date

PostPosted: Mon Oct 15, 2012 3:12 pm
by mskv1309
Thanks Jdruijn & jgarfield.