import("system.db");
import("system.result");
import("Sql_lib");

//TODO: this should happen by 1:1 links instead of manually requesting the data by a select (getRows ??)
var country = newSelect("ADDRESS.COUNTRY")
                .from("ADDRESS")
                .join("CONTACT", "CONTACT.ADDRESS_ID = ADDRESS.ADDRESSID")
                .whereIfSet("CONTACT.CONTACTID", "$param.ObjectRowId_param")
                .cell();

if (country != "") 
    result.string(country);