Not null in related record?

Questions, tips and tricks and techniques for scripting in Servoy

Not null in related record?

Postby alb » Tue Jul 07, 2009 11:41 pm

I have two tables master & history which have a relationship.
I need to do a find for all records in master where the date_left columns is NOT NULL.
Can't seem to get the syntax correct, both for the not null and the related column.

This is the function attached to the master form that doesnt work :(


function activeOnly()
controller.find()
date_left = '^' <- how do I specify 'where history.date_left' is NOT NULL'
controller.search(true,false)
}
alb
 
Posts: 148
Joined: Sun Aug 13, 2006 4:40 am

Re: Not null in related record?

Postby ROCLASI » Tue Jul 07, 2009 11:53 pm

Hi alb,

In Servoy you use the exclamation point for 'NOT'.
So your code looks like this
Code: Select all
function activeOnly()
{
   controller.find();
   date_left = '!^';
   controller.search(true,false);
}
Robert Ivens
SAN Developer / Servoy Valued Professional / Servoy Certified Developer

ROCLASI Software Solutions / JBS Group, Partner
Mastodon: @roclasi
--
ServoyForge - Building Open Source Software.
PostgreSQL - The world's most advanced open source database.
User avatar
ROCLASI
Servoy Expert
 
Posts: 5438
Joined: Thu Oct 02, 2003 9:49 am
Location: Netherlands/Belgium

Re: Not null in related record?

Postby alb » Wed Jul 08, 2009 12:02 am

Thanks thats great. I also worked out that to search in a related record all I need to do is prefix the relationship so the code becomes:

function activeOnly()
{
controller.find()
member_to_history.date_left = '!^'
controller.search(true,false)
}

Too easy :)
Spent too many years coding SQL directly..........
alb
 
Posts: 148
Joined: Sun Aug 13, 2006 4:40 am


Return to Methods

Who is online

Users browsing this forum: No registered users and 36 guests

cron