Flavors of load records

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

Flavors of load records

Postby mskv1309 » Thu Oct 18, 2012 2:50 pm

I went to wiki in servoy 6.0 for flavors of load records in servoy. Task becomes easy once we create relations and then say load record and pass pk as parameter.Thats good. I wonder what if we want to overwrite the relations programmatically and then load records. In other words, Is it possible to overwrite relations established at design level using join query and then load records. If it is possible what are step to follow in detail.

Any suggestion is appreciated.
mskv1309
 
Posts: 41
Joined: Thu Apr 26, 2012 10:05 pm

Re: Flavors of load records

Postby jgarfield » Thu Oct 18, 2012 5:00 pm

http://wiki.servoy.com/display/public/D ... oadRecords

e.g.

Code: Select all
foundset.loadRecords("SELECT tableA.primary_key FROM tableA JOIN tableB ON tableB.some_column = tableA.matching_column WHERE tableB.search_column = ?", ["searchValue"])
Programmer.
adBlocks
http://www.adblocks.com
jgarfield
 
Posts: 223
Joined: Wed Sep 28, 2005 9:02 pm
Location: Boston, US

Re: Flavors of load records

Postby mskv1309 » Thu Oct 18, 2012 5:40 pm

Thanks jgarfield for reply,
I want to filter by tableA as well as tableB. I want to join tableB which should have some WHERE clause or AND clause and then join tableA say for example

Code: Select all
foundset.loadRecords("SELECT tableA.primary_key FROM tableA JOIN tableB ON tableB.some_column = tableA.matching_column AND tableB.DateColumn=?  WHERE tableA.search_column = ?", [ TODAY(),"searchValue"))


Is this possible in servoy as when I execute my sql statement it give me improper data
Code: Select all
foundset.loadRecords(SELECT employee.emp_id  FROM  employee LEFT OUTER JOIN employeejob  ON employee.emp_id=employeejob.emp_id AND employeejob.startdate=? WHERE employee.status=?,[TODAY(),"searchValue"])


In other words I want to load details of employees for today's date

In MS SQL SERVER, the above query execute correctly whereas in servoy is not able to interpret " AND employeejob.startdate=? " instead iit is interpreting as "foundset.loadRecords("SELECT tableA.primary_key FROM tableA JOIN tableB ON tableB.some_column = tableA.matching_column WHERE tableB.search_column = ?", ["searchValue"])
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 1 guest

cron