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)
Iterate and manipulate dataset before runtime
Tubal
Is it possible to manipulate a dataset before runtime?
Basically, I get a dataset from a query. I need the sum of the group to = x. If it's not, I need to find the smallest instance in the dataset, add an amount, and test again, until I reach my target. (this is the simple version. the complex version includes many columns of data and a complex query)
A simple while loop would work, I'm just not sure if/where this can be done after I've already got my data, before I show my results, or if I'm going to have to figure out a way to do this in my query.
Find more posts tagged with
Comments
Tubal
<blockquote class='ipsBlockquote' data-author="'Tubal'" data-cid="93400" data-time="1325547591" data-date="02 January 2012 - 04:39 PM"><p>
Is it possible to manipulate a dataset before runtime?<br />
<br />
Basically, I get a dataset from a query. I need the sum of the group to = x. If it's not, I need to find the smallest instance in the dataset, add an amount, and test again, until I reach my target. (this is the simple version. the complex version includes many columns of data and a complex query)<br />
<br />
A simple while loop would work, I'm just not sure if/where this can be done after I've already got my data, before I show my results, or if I'm going to have to figure out a way to do this in my query.<br /></p></blockquote>
<br />
In my dataSet onFetch even, I'm able to put the pertinent info from each result into an javascript array.<br />
<br />
I can manipulate my array how I want it, and put this new manipulated data into my table. The only place I can manipulate the data and have it show in the table is in the onCreate or onRender events of the table.<br />
<br />
However....<br />
<br />
If I filter the table on this data, it seems to be filtering on the data BEFORE it was manipulated, even though it shows the data after manipulation. <br />
<br />
i.e. row["x"] is bound to myArray[n][n]. if the filter is row["x"] > 0, then it filters on the value of array[n][n] before it was manipulated on the onCreate event.<br />
<br />
This doesn't make sense to me.<br />
<br />
So i guess my question is, at what point does the table filter itself? It would appear to filter before the onCreate and onRender events. <br />
<br />
Hopefully that makes sense.
mwilliams
From the sounds of your first post, you could store your values from your first dataSet into an array, like you are. Then, manipulate the values in this array til you get what you want and then use this array to create a scripted dataSet to use to display in your table. You'd just have to make sure you put a hidden text box that was bound to your first dataSet at the top of your report, to be sure the data is ran to populate your arrays, so your scripted dataSet you use for your table is populated.
Hope this helps. Let me know if I'm misunderstanding.