Jump to content
  • Question: How to create a feature that goes and gets the next 50 rows or previous 50 rows.


    Question, comments and answers for this topic.

    Question:

    I'm pretty new to IronPython and I can't figure out how to create a feature that goes and gets the next 50 rows or the previous 50 rows?

    I'm pretty new to IronPython and I can't figure out how to create a feature that goes and gets the next 50 rows or previous 50 rows.  I have a data set that's hundreds of rows long and I would like to display 50 rows at a time and use a Next 50/Previous 50 hyperlink or button.  Does anyone have a script like that?  Thanks in advance.

     

    Oct 21, 2015 - 1:37pm

    User

    (7) Answers

    Answer 1:

    This is interesting actually. I think it would best be done with an on-demand data table that took an index parameter as its input. It could start at 1 and get +50 (max=# of rows in data) with a script when you click the next button and -50 (1 = min) if you click the previous button. That script would update the parameter and the parameter change would trigger the on-demand data table execution. The information link of that on-demand data table would then use that parameter to return the correct rows based on that starting point.

    Oct 23, 2015 - 3:37pm

    Sean Riley

     

    Answer 2: Best Answer

    Attached (Download from Resources below) is a dxp (v6.5, embedded just so you can open it). The modified IL is on the left which has an input parameter which is the row number to return (this returns 10 rows). That is used for the on-demand data table with a document property as the input parameter. The 2nd data table is just a table that returns the count of rows in the data table so we can ensure we don't go beyond the last row in the table when setting the index via the IronPython scripts.

    Please note that I manually created my index row number in SQL with that query, if you had an ID row already in your data table your query could be much more efficient by avoiding the nested SELECT statement and using the index directly in the WHERE clause of a single SELECT statement (just modifying the WHERE clause of the info links default SQL). That would be ideal.

     

     

    Answer 3:

    This is pretty awesome Sean...Thanks! I'm going to take a look at it and try to working it into my analysis. Thanks again!

     

    Oct 23, 2015 - 3:37pm

    User

      

    Answer 4:

    Cool, hope it helps!

    Please note that I manually created my index row number in SQL with that query, if you had an ID row already in your data table your query could be much more efficient by avoiding the nested SELECT statement and using the index directly in the WHERE clause of a single SELECT statement (just modifying the WHERE clause of the info links default SQL). That would be ideal.

    Oct 23, 2015 - 3:37pm

    Sean Riley

     

    Answer 5:

    Why not create a calculated column with RowId() and make the filter a range filter? Are your users using Webplayer? The webplayer cache feature in its engine handles large amount of data very good. If you have a table vis and launch WP, you will think that Spotfire loads 2 or 3M rows in seconds but what you are really happening is that Spotfire loads only the data visible on display (+ a little extra) which is no more than 100 rows. As soon as you scroll down, the new data to be displayed is fetched asynchronously, which is another 100 rows or so. Similar thing happens with any other visualization. For the client, you have to pay the initial loading of data into memory though.

    I am not sure what you are trying to achieve, but you can also use a stored procedure and send the starting row number + the max amount as parameters. You can set the doc properties via simple script to do the +/- 50 rows chunk increment that will be passed to the SP parameters.

    As far for the script goes, it can be done and it is simple to do, but I am not sure if it is the best way without additional background info.

     

     

    Oct 23, 2015 - 3:37pm

    User

     

    Paginated Information Link_Embedded_0.dxp


    User Feedback

    Recommended Comments

    There are no comments to display.


×
×
  • Create New...