NeoInJS Posted September 13, 2016 Report Share Posted September 13, 2016 I created a Tabular report with this fields - ID, Requested, Fulfilled. I added HTML Block as another field 1. What script can I insert to shown difference of Requested and Fulfilled? 2. If the difference > 0, it should be linked to another datapage 3. If difference = 0, it should have an alert saying that this item is already fulfilled Quote Link to comment Share on other sites More sharing options...
nightowl Posted September 13, 2016 Report Share Posted September 13, 2016 Hi NeoInJS, if you're using just a single result in the report, you can use this code snippet (don't forget to change the column indexes and URLs): <script type="text/javascript"> var rowData = document.getElementsByClassName('cbResultSetData'); var requested_col = 3; // TODO: Change this column index --> var fulfilled_col = 4; // TODO: Change this column index --> var requested = parseInt(rowData[requested_col - 1].innerHTML); var fulfilled = parseInt(rowData[fulfilled_col - 1].innerHTML); var diff = requested - fulfilled; if (diff > 0) { document.write('<a href="SUBMISSION_DATAPAGE_URL">LINK_LABEL</a>'); } else if (diff === 0) { document.write('<a href="#" onclick="javascript:showMessage();">0</a>'); } function showMessage() { alert('Already fulfilled'); } </script> Hope this helps. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.