Why am I unable to pass through a calculated value to a document property?

I've been using the following as a test run for passing calculated values to document properties for later use:



1. Create a calculated value 
and put it inside the calcVal 
tag:"<SpotfireControl id="3d532a5eb61d4521bc802497a8760711" /><SPAN id=calcVal><SPOTFIRECONTROL id=b0b2460b733a4a0e8262415cfa7bda29></SPOTFIRECONTROL></SPAN>"

2.Create a (hidden) input property control 
that updates <I>myPropertyControl:</I> "<SpotfireControl id="711030cc55f24418894ba39d1748a22d" /><SPAN id=inputPropertyControl><SPOTFIRECONTROL id=3deeabc9aec0460da2cd2e9ef3a98669></SPOTFIRECONTROL></SPAN>"

3. Optionally add a 
label property control to make sure the value is transferred
Label Property Control <I>myPropertyControl</I>:"<SpotfireControl id="04797226134f4e579d3267e7e312a222" /><SPOTFIRECONTROL id=25954a...></SPOTFIRECONTROL>"

4. Optionally add a button to manually trigger the javascript that transferred to the "myPropertyControl" Document Property: 

<span id="transferValueBtn">Transfer</span>

The calculated value takes real number column inputs and uses the following expression to spit out another real number.  Essentially, it's just interpolating based on a straight line fit.  (I realize there's probably an easier way of doing this calculation but I'm literally brand new to scripting)

((Sum([Btu Content] * [Ethane]) - (Sum([Btu Content]) * Sum([Ethane]) / Count(RowId()))) / (Sum([Btu Content] ^ 2) - ((sum([Btu Content]) ^ 2) / Count(RowId())))*${TargetBtuContent})+(Sum([Ethane])/Count(RowId()) - ((Sum([Btu Content] * [Ethane]) - (Sum([Btu Content]) * Sum([Ethane]) / Count(RowId()))) / (Sum([Btu Content] ^ 2) - ((sum([Btu Content]) ^ 2) / Count(RowId()))))*(Sum([Btu Content])/Count(RowId())))


Then there's a button with the following javascript embedded:

var oldValue=0
transferValue = function(){

   //get value from calcVal spotfire Calculated Value Dyn Item

   //update input when oldValue changes
      $("#inputPropertyControl input").val(value).blur(); 

//test value manually

//if button works, then un-comment this line to automatically refresh
//setInterval(transferValue,333) //3 times per second

As of now, nothing happens when I click the button.  Although the instructions I'm attempting to follow don't say anything about assigning script parameters, is that something that needs to be done here?

Another concern I have is that data types are not consistent but I don't know if there's anything to that.

Any help would be greatly appreciated.

(2) Answers