Business Intelligence Tools

How to Pass Marked Data into a Document Property

Consider this scenario, you have a calculation that necessitates the ability to pull a value from marked data. This is a complicated feedback system.

Setup the components

First, let’s setup the moving parts:

  • Create a document property ${sumMarkedRows}. This is going to be the document property that we’ll use in our calculation.
  • Created a text area. We need this so that our JavaScript can pass the data to the document property.
  • In the text area, add a Calculated value that is Sum([Column]).
  • Pick a marking layer that will facilitate this connection.

Connect the parts

Next we’ll need to pass that data from the marked layer to the calculated value to the JavaScript to the document property. What a mouthful!

  1. Create an input field for ${sumMarkedRows}
  2. Create a JavaScript that is called when the calculated value changes so we can pass it to the document property:

    <script>
    $(‘theIDoftheSpotfireCalcValue’).on(‘DOMSubtreeModified’,function(){
    $(‘theIDoftheInputfield’).text($(‘theIDoftheSpotfireCalcValue’).text());
    $(‘theIDoftheInputfield’).blur();
    })
    </script>

  3. That script needs the IDs swapped out then you can put it in the HTML area of that text area.
  4. Use ${sumMarkedRows} in your calculated column as the value that changes
  5. Wrap all of that with <div style=”display:none”>   …all the html…  </div> to hide that trickery

2 thoughts on “How to Pass Marked Data into a Document Property

  1. Ch3rry Reply

    Hi,

    Could you please let me know how to assign the Maximum (Largest) value of selected multiple Bars in a Bar chart to a Document Property?

    Your help is much appreciated! Thanks.

  2. Cherry Reply

    Hi,

    Could you please let me know how to assign the Maximum (Largest) value of selected multiple Bars in a Bar chart to a Document Property?

    Your help is much appreciated! Thanks.

Leave a Reply

Your email address will not be published. Required fields are marked *