in
Creating Smarter Networks

Getting datapoint with JavaScript

Last post 07-01-2009 5:35 AM by crl. 1 replies.
Page 1 of 1 (2 items)
Sort Posts: Previous Next
  • 06-21-2009 1:02 AM

    • Alex27
    • Top 50 Contributor
    • Joined on 04-24-2009
    • Posts 2
    • Points 40

    Getting datapoint with JavaScript

    Hi!
    I've got a problem...Is it possible to get the value of 2 or more different datapoints within the same JavaScript file?

    Right now I have the following Code within an HTML-webpage which calls the JavaScript-file and contains the name of the one datapoint "SwitchA":


    < div elon_type="generic" elon_version_number="4.0" elon_lang="{elon_language}" elon_javascript_class="iLonVisionExtensions/getdatapoint">
    < div elon_arg_name="name_arr" elon_arg_type="array">
    < div elon_arg_type="object" elon_name="SPION_PEES/Channel 1/SPION_SmartServer/Web Server[1]/SwitchA" elon_lonformat="#0000000000000000[0].SNVT_switch"> < /div>
    < /div>
    < /div>

    The JavaScript-file looks like this an prints either "ON" oder "OFF" to the webpage:


    function getdatapoint(argObj){

    this.update = function(type, item){

    if(item.UCPTvalue[1].get()=="OFF")
    var text1 = argObj.domObj.appendChild(document.createTextNode("OFF"));
    else
    var text2 = argObj.domObj.appendChild(document.createTextNode("ON"));

    }
    };
    EchelonTop.Echelon.provide("getdatapoint", document);



    But I want to get the value of several datapoints. What would be the correct JavaScript Code???? Thanks a lot for help.

    Ruffy

    • Post Points: 20
  • 07-01-2009 5:35 AM In reply to

    • crl
    • Top 50 Contributor
    • Joined on 07-01-2009
    • Posts 3
    • Points 45

    Re: Getting datapoint with JavaScript

    Hi Ruffy,

    you can easily access several data points, but you have to specify them in iLON Vision. The generated HTML containing these parameters looks like this:

    <div elon_arg_type="array" elon_arg_name="name_arr">
       <div elon_name="Net/VirtCh/iLON System/VirtFb/CpuUsage" elon_arg_type="object"></div>
       <div elon_name="Net/VirtCh/iLON System/VirtFb/FreeRAM" elon_arg_type="object"></div>
    </div>

    AFAIK, other than that there is no way to access DPs that were not specified in iLON Vision (and hence, HTML).

    Best regards

    CRL

    • Post Points: 5
Page 1 of 1 (2 items)
©2008 Echelon Corporation