The Items.Results object provides an API to get the result of a formula in a column of numbers (type: number).
Since:
5.1
| Function Summary | |
function
|
getData( <String> stylesheet )
|
| Function Detail |
getData
function getData( <String> stylesheet )
Example: The following sample Klip outputs the difference between the sum of current and the sum of the previous values to the Debug Window.
<?xml version="1.0" encoding="UTF-8" ?>
<klip>
<owner>
<author>
Klipfolio Inc.
</author>
<website>
http://www.klipfolio.com
</website>
</owner>
<identity>
<title>
API: Items.Results.getData()
</title>
</identity>
<locations>
<defaultlink>
http://www.klipfolio.com/
</defaultlink>
<contentsource>
<![CDATA[
<item>
<previous>20000</previous>
<current>45000</current>
</item>
<item>
<previous>15000</previous>
<current>5000</current>
</item>
<item>
<previous>60000</previous>
<current>40000</current>
</item>
]]>
</contentsource>
<icon>
http://www.klipfolio.com/static/klips/klipfolio/sample_icon.png
</icon>
<banner>
http://www.klipfolio.com/static/klips/klipfolio/sample_banner.png
</banner>
</locations>
<setup>
<columns>
true
</columns>
</setup>
<style>
item {
type: item;
definition: all;
}
current {
type: number;
itemcol: 1;
formula: sum;
}
previous {
type: number;
itemcol: 2;
formula: sum;
}
diff {
type: number;
content: generated;
formula: "current-previous";
}
</style>
<klipscript>
<![CDATA[
//
// Called whenever the Klip is refreshed.
//
function onRefresh ()
{
var success = Engines.Data.process (Prefs.contentsource);
traceln( "current - previous = " + Items.Results.getData("diff") );
return success;
}
]]>
</klipscript>
</klip>
-
Parameters:
stylesheet - name of the selector for the column from which to get the result
-
Returns:
-
the result of the formula in the specified column
|
Klipfolio Dashboard API | ||||||||
| PREV OBJECT NEXT OBJECT | FRAMES NO FRAMES | ||||||||
| SUMMARY: PROPERTY | FUNCTION | DETAIL: PROPERTY | FUNCTION | ||||||||
© 2011 Klipfolio Inc. All Rights Reserved.