Skip to Main Content
Spotfire Ideas Portal
Status Future Consideration
Product Spotfire
Categories Data Functions
Created by Guest
Created on Sep 11, 2020

Don't execute data functions when required input data is empty

Many data functions you want triggered from markings. However, when nothing is marked, empty inputs are sent to the DF which causes errors. So you have to create specific error handling code for TERR to detect # rows for input and send out empty data.frames if there are 0 rows. In R, this can often require wrapping large blocks of code with if-statements.

This isn't really how one typically scripts in R, Python, etc natively since when you run a script outside Spotfire, you already have your data loaded, not empty inputs. It's the Spotfire paradigm of marking that requires empty data.frames to come out as outputs, but the coding itself could be much more simplified if Spotfire just knew not to execute the DF at all if no rows were marked. This would make it easier to copy/paste code from RStudio, etc into Spotfire directly.

  • Attach files
  • Guest
    Reply
    |
    Apr 12, 2022

    I think the ideal situation would be to have a drop down option in the data function configuration on how the data function behaves with the marking, much like is present on visuals e.g.

    If no data is marked either:

    Pass all data
    Do not run data function
    Raise warning/error (much like display message for a visual)

    We often have scenarios where we want the whole dataset to be passed when no marking is present so I think this would be a useful option as well as do nothing, and raise an error.

  • Guest
    Reply
    |
    Nov 4, 2020

    I am not sure we want the function not to throw an error when the user fails to select or mark for the definition of the inputs.

    I have struggle with this myself, I feel you need the function to throw an error, or perhaps a warning, if the inputs are not been passed to the data function. The way we have worked around this issue is to use document controls to trigger the data function to run. In my mind, the problem is running the function automatically instead of letting the user decide when to run the function.

  • Guest
    Reply
    |
    Sep 18, 2020

    I agree that when you execute a data function on empty you don't really want an output

  • Guest
    Reply
    |
    Sep 14, 2020

    It would be useful in general not to execute data functions with empty inputs. I sometimes have this situation without limiting by marking. If you use on-demand data, it sometimes happens that a data table is empty. If it is an input to a data function, this has to be captured also.

    Perhaps one could make this an option: "Do not execute DF when one of the inputs is empty".

    As there can be multiple inputs to DFs and it might make sense that the DF is executed when an input is empty but others are not, it might be necessary to have an option per input. "Do not execute DF when THIS input is empty".