Use a Root function to set an environment prior to fetching the data, for example to ensure that source data is not extracted from Production to avoid overloading the source system. The Root function sets the environment on a session level and selects the data from the source environment:
String sql = "SELECT * From ACTIVITY WHERE CUSTOMER_ID = ? ";
ludb().fetch(sql, i_customer_id).each(row->{
yield(row.cells());
});
fabric().execute("set environment='" + SOURCE_ENV_NAME + "'");
Full example of the entire fnPop_NEW_ACTIVITY Root Function can be found in the Demo project.
Use a Root function to retrieve source data from several data sources, for example the current LU and an additional DB interface. Add an SQL query per each data source.
String sql1 = "Select * From ACTIVITY where CUSTOMER_ID = ?";
Db.Rows rows = ludb().fetch(sql1,i_customer_id);
ludb().fetch(sql1, i_customer_id ).each(row-> {
...
caseRows = db("CRM_DB").fetch(sql2,activityID);
for (Db.Row caseRow:caseRows) {
//retrieve the required data
...
//create an Array to add the output into Object[]
List<String> caseList = new ArrayList<String>();
caseList.add(customerID);
...
yield(result);
});
}
Full example of the entire fnPop_ACT_CASE_NOTE Root Function can be found in the Demo project.
Create a dummy Root function when the LU table is populated by an Enrichment function or a population of another LU table:
if (1 == 2) yield(new Object[]{null});
Use a Root function to set an environment prior to fetching the data, for example to ensure that source data is not extracted from Production to avoid overloading the source system. The Root function sets the environment on a session level and selects the data from the source environment:
String sql = "SELECT * From ACTIVITY WHERE CUSTOMER_ID = ? ";
ludb().fetch(sql, i_customer_id).each(row->{
yield(row.cells());
});
fabric().execute("set environment='" + SOURCE_ENV_NAME + "'");
Full example of the entire fnPop_NEW_ACTIVITY Root Function can be found in the Demo project.
Use a Root function to retrieve source data from several data sources, for example the current LU and an additional DB interface. Add an SQL query per each data source.
String sql1 = "Select * From ACTIVITY where CUSTOMER_ID = ?";
Db.Rows rows = ludb().fetch(sql1,i_customer_id);
ludb().fetch(sql1, i_customer_id ).each(row-> {
...
caseRows = db("CRM_DB").fetch(sql2,activityID);
for (Db.Row caseRow:caseRows) {
//retrieve the required data
...
//create an Array to add the output into Object[]
List<String> caseList = new ArrayList<String>();
caseList.add(customerID);
...
yield(result);
});
}
Full example of the entire fnPop_ACT_CASE_NOTE Root Function can be found in the Demo project.
Create a dummy Root function when the LU table is populated by an Enrichment function or a population of another LU table:
if (1 == 2) yield(new Object[]{null});