Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
PUBLIC CLOUD
PRIVATE CLOUD
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Intelligence (Analytics)
Script to set the value of a column in a table given data in other columns
gdittmar
Hello all,
I have a feeling this is probably a very simple thing to do but I have not found the correct API calls / examples that shows me how I can write a script that calculates a value for a column on the fly for me. For example I have a table with 4 columns and numeric values for the first 3 in my dataset. I want the 4th column to be the weighted average, or some other function, of the first three columns. so I believe I need a script for the onCreate portion of my table and I need to grab the values for the columns and then write the weighted avg out to the 4th column. I can seem to get the values of a column but have not found a function to write a new value back to the table. Am I maybe going about this the wrong way and should look at a scripted dataset where I have a java class doing this computation for me before hand?
thanks!
Find more posts tagged with
Comments
Hans_vd
Hi gdittmar,
If the three columns are in the same dataset you can edit the dataset and add a "computed column" to it. There you can choose from a list of aggregational functions and/or write your own expression.
Or you can drag a Data item to the table and build your own expression from dataset columns and table column bindings
Hope this helps
Hans
gdittmar
<blockquote class='ipsBlockquote' data-author="'Hans_vd'" data-cid="98272" data-time="1332830346" data-date="26 March 2012 - 11:39 PM"><p>
Hi gdittmar,<br />
<br />
If the three columns are in the same dataset you can edit the dataset and add a "computed column" to it. There you can choose from a list of aggregational functions and/or write your own expression.<br />
<br />
Or you can drag a Data item to the table and build your own expression from dataset columns and table column bindings<br />
<br />
Hope this helps<br />
Hans<br /></p></blockquote>
<br />
Yeah that pretty much solved it. Found the computed column thing about an hour after I posted and pretty much solved the issue I had. I think I am still going to need to do some scripting for some other parts of my report but at least I know how to do this. Just curious but is there an api / method call that would let me set the value of a column in a table as its being created?