I am needing to create a single table that displays values from a Cloud SQL data model and Calculated data model side by side as if the data models were related.
Costs Table
I have a calculated data model named 'Costs' that is populated from a spreadsheet. The data in this table looks like this:
PROJECT_ID, ACCRUED_COSTS, REMAINING_COSTS 0001 , 10000 , 25000 0002 , 25000 , 2000 0003 , 15000 , 5000
The code I'm using to generate the calculated model is here:
return getSSData();
function getSSData(){
var values = SpreadsheetApp.openById("SPREADSHEET_ID").getSheetByName("SHEET_NAME").getRange("RANGE").getValues();
var ssData = [];
for (var i = 0; i<values.length; i++){
var newRecord = app.models.costsTable.newRecord();
// add all fields to the new record
newRecord.project = values[i][0].toString();
newRecord.projectID = values[i][1].toString();
newRecord.actual = values[i][2];
newRecord.estimate = values[i][3];
ssData.push(newRecord);
}
// return the array of the model.newRecord objects that would be consumed by the Model query.
return ssData;
}
Projects Table
I also have a Cloud SQL data model named 'Projects'. The data in this table looks like this:
PROJECT_ID, PROJECT_NAME , PROJECT_BUDGET 0001 , project_alpha , 50000 0002 , project_beta , 30000 0003 , project_charlie, 19000
Combined Table
I need to create a page containing a table widget that displays all columns of data from both tables side by side like this:
PROJECT_ID, PROJECT_NAME , PROJECT_BUDGET, ACCRUED_COSTS, REMAINING_COSTS 0001 , project_alpha , 50000 , 10000 , 25000 0002 , project_beta , 30000 , 25000 , 2000 0003 , project_charlie, 19000 , 15000 , 5000
The Problem
This would be easy if the tables could be related to each other but unfortunately calculated models do not support relating.