You need to sign in to do that
Don't have an account?
Client Services
Create Google Table Using Analytics API
Hi All--
I'm new to Salesforce and am trying to build a VF page that will display 25 records and 5 Columns using the analytics api. I have gotten the following code to properly display the 25 records, however it only displays 2 columns (Property Name and Record Count). I have tried building the underlying report in matrix, summary, and tabular format...each with the same result. I believe there is something in the code that is limiting the display to 2 columns, but I can't figure it out. The columns I need displayed are all custom.
Thanks in advance for your help! You don't know how amazing it will be if I get this down :)
<apex:page sidebar="false" showHeader="false">
<apex:includeScript value="https://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js" />
<apex:includeScript value="https://www.google.com/jsapi" />
<script>
google.load('visualization', '1', {
'packages': ['table']
});
$(document).ready(function () {
$.ajax('/services/data/v29.0/analytics/reports/{!$CurrentPage.parameters.reportId}', {
beforeSend: function (xhr) {
xhr.setRequestHeader('Authorization', 'Bearer {!$Api.Session_ID}');
},
success: function (reportResult) {
var chartPoints = [];
$.each(reportResult.groupingsDown.groupings, function (index, value) {
chartPoints.push([value.label, reportResult.factMap[value.key + "!T"].aggregates[0].value]);
});
var options = {};
var labels = [
[
reportResult.reportExtendedMetadata.groupingColumnInfo[reportResult.reportMetadata.groupingsDown[0].name].label,
reportResult.reportExtendedMetadata.aggregateColumnInfo[reportResult.reportMetadata.aggregates[0]].label
]
];
var myData = google.visualization.arrayToDataTable(labels.concat(chartPoints));
var table = new google.visualization.Table(document.getElementById('table'));
table.draw(myData, {showRowNumber: false});
}
});
});
</script>
<div id="table" style="height: 400px;width:400px;"></div>
</apex:page>
I'm new to Salesforce and am trying to build a VF page that will display 25 records and 5 Columns using the analytics api. I have gotten the following code to properly display the 25 records, however it only displays 2 columns (Property Name and Record Count). I have tried building the underlying report in matrix, summary, and tabular format...each with the same result. I believe there is something in the code that is limiting the display to 2 columns, but I can't figure it out. The columns I need displayed are all custom.
Thanks in advance for your help! You don't know how amazing it will be if I get this down :)
<apex:page sidebar="false" showHeader="false">
<apex:includeScript value="https://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js" />
<apex:includeScript value="https://www.google.com/jsapi" />
<script>
google.load('visualization', '1', {
'packages': ['table']
});
$(document).ready(function () {
$.ajax('/services/data/v29.0/analytics/reports/{!$CurrentPage.parameters.reportId}', {
beforeSend: function (xhr) {
xhr.setRequestHeader('Authorization', 'Bearer {!$Api.Session_ID}');
},
success: function (reportResult) {
var chartPoints = [];
$.each(reportResult.groupingsDown.groupings, function (index, value) {
chartPoints.push([value.label, reportResult.factMap[value.key + "!T"].aggregates[0].value]);
});
var options = {};
var labels = [
[
reportResult.reportExtendedMetadata.groupingColumnInfo[reportResult.reportMetadata.groupingsDown[0].name].label,
reportResult.reportExtendedMetadata.aggregateColumnInfo[reportResult.reportMetadata.aggregates[0]].label
]
];
var myData = google.visualization.arrayToDataTable(labels.concat(chartPoints));
var table = new google.visualization.Table(document.getElementById('table'));
table.draw(myData, {showRowNumber: false});
}
});
});
</script>
<div id="table" style="height: 400px;width:400px;"></div>
</apex:page>
I find myself stuck in almost exactly the same spot and haven't found any similar postings with a solution.