Clarity

Expand all | Collapse all

Displaying Database Content in HTML Portlets

Jump to Best Answer
  • 1.  Displaying Database Content in HTML Portlets

    Posted 03-07-2012 01:55 PM
    Does anyone know if you can use variables, SQL or other syntax to display database content inside an HTML portlet? For example, I am trying to create a portlet that brings back the current project name, project manager name, finish date, etc and format that into a table to display on a dashboard above some standard grid based portlets.

    One of the main reasons for this need is that I want something similar to the "General" system portlet, but I want to be able to modify the fields that are displayed. I would also like to format the size of font on some of the attributes.

    I am hoping that Clarity will allow this. Please let me know if you have any thoughts on this.
    thanks,
    Jeff


  • 2.  RE: Displaying Database Content in HTML Portlets
    Best Answer

    Posted 03-09-2012 07:16 AM
    Clarity will allow this but it's not as easy as referencing some variables. To pull data from the database (correctly) requires a web service approach.

    That involves using some javascript as your html portlet to take the sessionId from the cookie and compose a web service request to Clarity to run a query (or XOG output some data), which you then parse and display in your portlet as the results come back using XSL Transformations to turn the XML response into a HTML table or DIVs/SPANs section.

    We've used the same javascript function that can be found here for (easily) fetching the sessionId value from the cookie: http://www.w3schools.com/js/js_cookies.asp

    And this one for taking the XML response of the SOAP request and transforming it with some XSL: http://www.w3schools.com/xsl/xsl_client.asp

    If you have an NSQL query all ready to try, you could test with the file I'm attaching as the body of your HTML portlet to reference it. It isn't bullet-proof but serves as an example of putting these elements together, you'll just need to make a change near the top of the file to reference your own NSQL's query ID:

    <script type="text/javascript">
    // <!--
    // change this to your own NSQL query's ID
    var nsql_id = "hgrid_multipage"; // <-- change this value
    // -->
    </script>
    ...

    Hopefully that gives you a starting point at least.

    -Nick


  • 3.  RE: Displaying Database Content in HTML Portlets

    Posted 03-10-2012 10:05 AM
    Hi,

    Please find attached sample HTML portlet which calls NSQL and displays data on portlet.

    Thanks,
    -N.P.


  • 4.  Re: RE: Displaying Database Content in HTML Portlets

    Posted 02-01-2016 11:03 AM

    Hey nick_darlington - any chance of re-attaching your "simple html portlet" code to this thread?

     

    (I can't make head nor tail of NP's one! )



  • 5.  RE: Displaying Database Content in HTML Portlets

    Posted 08-02-2012 01:52 PM
    Is it possible to update database content through HTML portlets? We have a need to update Resource Allocations in a portlet with in-line editing.

    Thank you,
    Rajani.


  • 6.  RE: Displaying Database Content in HTML Portlets

    Posted 03-14-2013 11:01 PM

    N.P wrote:

    Hi,

    Please find attached sample HTML portlet which calls NSQL and displays data on portlet.

    Thanks,
    -N.P.
    Hi.
    No attachments are shown in this thread.
    Are you able to respond and re-attach? It should exactly like what we want to do, but have been struggling.

    thanks
    marlon.


  • 7.  RE: Displaying Database Content in HTML Portlets

    Posted 03-15-2013 04:45 AM
    I have not seen that either. :-(

    Martti K:


  • 8.  RE: Displaying Database Content in HTML Portlets

    Posted 08-03-2012 04:09 AM
    Yes you can, if the content you want to change is modifiable through a XOG write request. It's just another soap request, like the one used to fetch the query results in the HTML portlet example, though you'd have to write the javascript and XML a little differently to drive that behaviour.


  • 9.  RE: Displaying Database Content in HTML Portlets

    Posted 03-21-2013 11:00 PM
      |   view attached
    Sorry guys, I am not sure how attachment is missing.. Or may be I forgot to attache.

    Attachment(s)

    doc
    Sample HTML Portlet.doc   178 KB 1 version


  • 10.  RE: Displaying Database Content in HTML Portlets

    Posted 03-22-2013 03:10 AM
    Thanks. :smile

    Martti K.


  • 11.  RE: Displaying Database Content in HTML Portlets

    Former Employee
    Posted 03-22-2013 06:04 PM
    You probably did attach but attachments were one of the things lost in the boards restore a couple months ago. They are working to restore them but for now will need to added back in when possible. Thanks! Chris