Find weeknr by SQL query

I guess this would be a nice thing to know for more SQL newbies like me :wink: :

How can I find a weeknr by a query?

I tried this:

var week = globals.gTempnr;
var query = 'SELECT tableid FROM table WHERE currentweek = ' +  week ;
bla,bla,bla

the column ‘currentweek’ is a calculation that looks like this:

if(date)
{
var week = parseInt(utils.dateFormat(date, 'w'));
return week;
}

I guess the query doesn’t recognize the content from a calc, 'cause the query doesn’t return any records…

Is the calculation a stored calculation ?
You can only query with SQL from the database, not from servoy-only defined calculations

Hope this helps.

ROCLASI:
Is the calculation a stored calculation ?

Yes, it is…

Now it does work perfectly! Just as I described in the first post… don’t ask me what I forgot… :oops: