Displaying rows in an interactive view

Hi,
When setting up a component node with filter slider widgets, is it possible in the interactive view to get it display the current number of rows as you move the sliders.
I have a table view node in there which I use with the table dimensions node but it doesn’t update the row number.

Simon.

Hi Simon

Have you enabled hiliting? If you tick that box in the according nodes it should work.
image
Hope that helps :slight_smile:

Best
Alice

1 Like

Hi,
I cannot find any nodes with “enable hiliting” option. Below shows the nodes I am using in the Component node, for which I am trying to get the Table View node to display the number of rows as the user alters the Sliders.

Hi Simon

Thanks for the screenshot! That always helps. And sorry the hiliting advice didn’t do the job, my bad.
Are you working in the AP, or is the workflow supposed to run in the webportal?

1 Like

Hi Alice,
This is just working in the Knime client itself and using the interactive view option of the component node.

Simon.

Hi Simon

ok, then the Slider Filter Widget nodes might not be the best choice. I tried to reconstruct your component and changed some of the nodes (and omitted the Extract Table Dimensions, see below). Don’t know about your input data, but please let me know if that works for you.

Best
Alice

1 Like

Hi Alice,
Thanks for this. But sorry for not being clear as to the problem I am facing.
This is correct in what I want to do with it showing the filtered rows, but I also wanted a way for it to display how many rows are left in the table.

This is important in knowing how changing a slider affects the number of rows filtered so the user can fine tune the slider without removing too many rows from the table.
This is why I had the table dimension node to get this, but it will not update with the number of rows.

Thanks,

Simon.

Hi Simon

aha sorry, I completely got it wrong then!
At the end of the table you can see how many rows have been filtered. Will that do it?

2 Likes

Thanks Alice, but as the table changes in size you need to scroll down to find it. Ideally I wanted it set at the top of the interactive view next to the slides so the user can see the remaining rows in real-time of moving the slider.

Simon.

Hi @richards99,

to avoid scrolling you can either organize your Component view to have Slider(s) under the Table View either configure Table View to show only 10 entries per page (or max that enables you to see change).

Slider won’t re-execute Extract Table Dimension node and subsequently refresh Table View…

Br,
Ivan

1 Like

Hi

I kept playing around with it yesterday. Only option I saw was attaching a table view to the table dimension, and then opening-close&apply the interactive view twice, so that the second time the other table would display the number of rows determined during the first time. I know this is very unsatisfying and not exactly what you wanted.

Gonna discuss it with the developer team, but for now ipazin’s suggestion is the best that works, I’m sorry!

Best
Alice

1 Like

I suspect ‘have you tried a Generic JavaSript View’ will be as disliked as ‘use a Java Snippet’ but maybe it’s possible to make a Generic JavaScript view that simply displays the number of filtered results and then stick this in where you’d like to see it?

I’d also very much like to see functionality where events in the view can trigger re-execution of the component if such functionality was possible to add :).

1 Like

Thanks Alice in all your efforts to find a solution.
Ipazin’s workaround will work for now but it would be better to have something better than this.

Simon.

Thanks swebb,
Unfortunately I can’t do JavaScript so that rules that one out for me.
It would be great if functionality is added to trigger re-execution of node as you mention in the components.

I was interested in being able to use this type of functionality also so I had a go.

I’ve been able to link into the selection events but can’t seem to see any change to the filter being applied. I can see the filter that’s updated but see no change in the underlying data table to indicate what has been filtered. Does every subscriber have to apply the filter themselves?

Is there any more documentation than what’s available here: How to Publish/Subscribe Events using Custom Javascript Views ?

1 Like

Forgot to attach the workflow. Maybe someone can show us how to properly capture the filter event to update the filtered row value?

How I tried to link into the filter:

knimeService.subscribeToSelection(knimeDataTable.getTableId(), selectionEvent, knimeDataTable.getFilterIds());

How I tried to get the rows that match the filter:

function getRowCount(filters) {
    var filterCount = 0;
    console.log('Processing filter');
    console.dir(filters);
    knimeDataTable.getRows().forEach(function (row, rowInd) {
	    if (knimeDataTable.isRowIncludedInFilter(row, filters)) {
		    filterCount++;
    	}	
    });
    return filterCount;
}

Hi @swebb,

you are on the right track, the only thing which is not right yet is, that knimeDataTable.isRowIncludedInFilter() expects rowKeys as first parameters and you are passing the row object. If you change that to row.rowKey it should work.

I have opened a ticket to also allow to pass a row object to the function.

Greetings,
Daniel

3 Likes

Thank you @DanielBog, I should have paid more attention to the source :man_facepalming:

@richards99 I’ve managed to get an example Generic JavaScript view working. Maybe this will let you achieve what you want for now?

I have linked in some flow variables via configuration nodes to allow some configuration without needing to change the javascript.

image

Table view: display as a table, otherwise display as a string
Filter list: Show the filters
Data filter title: a title to display above the filter results
Show title: whether to show the title

Or as just text output:

This is the layout I made:

I have updated the workflow but am having trouble connecting to the KNIME hub so it’s attached here:

RowCountsJavaScript.knwf (611.7 KB)

If you want to change what is displayed in text mode this is the bit you need to look at:

Text goes in ‘’, values can be concatenated with a +. The variable knimeDataTable.getNumRows() represents the number of rows in the table (make sure your max rows value is at least equal to the number of rows in the input. The variable filtered is the count of rows matching the filter and selected is the count of rows matching the selections.

So you could do something like:

html += filtered + ‘/’ + knimeDataTable.getNumRows() + ’ matched the filter’

Cheers

Sam

4 Likes

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.