|
|
Re: javascript to iterate through a dataset to find a value? [message #870321 is a reply to message #870042] |
Mon, 07 May 2012 16:05 |
|
This is probably similar to the way you did it but I use the onCreate
method on the detail row of a table to load up an array and then I can
use a simple expression to get any row/col. See attached.
Jason
On 5/5/2012 6:44 PM, manny wrote:
> To share...so found a way around this, I wrote javascript on event
> onRender for a hidden table element. This allows me to secretly
> traverse the table and search for what I want. Then I write the found
> information to a global variable which I then can read from my text
> field in the visible table that will display information. .
>
> Seems a lot of work..but I'm moving forward. perhaps there is a better
> way, if so I'd like to hear about it :D
>
>
> On Sat, 05 May 2012 08:35:39 -0700, manny
> <mannyfuf0fuz@xxxxxxxx> wrote:
>
>> I have a text element and through javascript I want to iterate the
>> dataset that is assigned to it to find a particular value.
>>
>> Say I have dataset bound to the text element that is made up of
>>
>> key value
>> a 1
>> b 2
>> c 3
>>
>> I want to be able to iterate to find 'C' and then fetch the value 3
>>from that row.
>>
>> to share, I don't know what the javascript should look like, but to
>> illustrate, I'm trying to do something like
>>
>> answer = "default"
>> for (i = 0; i< row.maxrow;i++){
>>
>> if ( row[i].getValue("value") == "a" ) {
>> answer = row[i].getValue("key")
>> }
>> }
>>
>>
>> I found a defect in bugzilla where others have requested similar
>> behavior but its been deferred.
>> (https://bugs.eclipse.org/bugs/show_bug.cgi?id=202376)
>>
>> OR......Is there some way I can accomplish this? Thanks again for the
>> help and apologies for my lack of knowing birt very well.
|
|
|
Powered by
FUDForum. Page generated in 0.03113 seconds