Jump to content

HTML Block as another field Results page


Recommended Posts

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

 

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

×
×
  • Create New...