PDA

View Full Version : Tip: Database!table access



barrymavin
2014-04-04, 03:39
Did you know that you can open and work with tables in multiple databases like this:



use southwind!customers
select * from southwind!customers


Interestingly this works with keylookup() also:



m_lastname = keylookup("southwind!employees","employeeid",orders.employeeid, lastname, "")


So using this in validation on the Desktop, Web and Mobile just works as expected when used with macros:



keylookup("southwind!employees","employeeid",{orders.employeeid}, .t., .f.)


Or if I want to lookup something synchronously on the server in JavaScript I can simply do this in one of my delegates.



var m_lastname = Lianja.evaluate('keylookup("southwind!employees","employeeid",{orders.employeeid}, lastname, ""');
if (len(m_lastname)==0) {
messageBox("Employee does not exist!");
return;
} else {
// process the employee name or update the UI with its value
}

HankFay
2014-04-04, 10:15
Nice!