Hi all,
I hope somebody can help me with some simple sample data which I can text and start with.
What I already have is a script file for the portlet which is pulling the data from a HTML file (see Below)
Where I am looking for is to make this dynamically.
I asked some input from NetSuite support but unfortunately I am not experienced enough in programming
They came back with:
1. Use nlapiLoadFile to load the file 2371746 from the file cabinet. (Done)
2. Use nlobjFile.getValue() to get the whole html content file as a string.
3. You will have to modify the string that is returned by the getValue().
Note: HTML tags will also be included in the string returned
4. Use nlapiCreateFile to create the newly modified string as an HTML file
5. Use nlapiSubmitFile to overwrite file 2371746 with the new HTML.
And to make it dynamic I need to use the below 2 SuiteAnswers
1. File APIs - Answer ID 10255
2. Executing Existing Saved Searches - Answer ID 10648
I hope sombody have already some simple code running which I may use to build my own knowledge to create nice charts.Thanks in advance [HR][/HR]SCRIPT
function HTMLClientPortlet(portlet, column)
{
portlet.setTitle('Charts')
var content = nlapiLoadFile(2371742).getValue() //id is the internal ID of the HTML file on the file cabinet
portlet.setHtml( content );
}
[HR][/HR]HTML
<html>
<head>
<!--Load the AJAX API-->
<script type="text/javascript" src="https://www.google.com/jsapi"></script>
<script type="text/javascript">
// Load the Visualization API and the piechart package.
google.load('visualization', '1.0', {'packages':['corechart']});
// Set a callback to run when the Google Visualization API is loaded.
google.setOnLoadCallback(drawChart);
// Callback that creates and populates a data table,
// instantiates the pie chart, passes in the data and
// draws it.
function drawChart() {
// Create the data table.
var data = new google.visualization.DataTable();
data.addColumn('string', 'Topping');
data.addColumn('number', 'Slices');
data.addRows([
['Mushrooms', 3],
['Onions', 1],
['Olives', 1],
['Zucchini', 1],
['Pepperoni', 2]
]);
// Set chart options
var options = {'title':'How Much Pizza I Ate Last Night',
'width':400,
'height':300};
// Instantiate and draw our chart, passing in some options.
var chart = new google.visualization.PieChart(document.getElementB yId('chart_div'));
chart.draw(data, options);
}
</script>
</head>
<body>
<!--Div that will hold the pie chart-->
<div id="chart_div"></div>
</body>
</html>
[HR][/HR]