Save
Saving
  • MattFox MattFox

    Bizarre, help docs used to mention using -1 as no limit. Glad you have got it sorted!

    Fox

    posted in User help read more
  • MattFox MattFox

    Here is something I have written for you to pull the rendered text values for binary and multistate points.

    Now you can use the created object to "map" your current values to their rendered text equivalents...
    If you don't understand how this works, feel free to yell out.

    var rql="or(";
     var items=[]
     //Get all points attached to the script context
     for(var i in CONTEXT_POINTS)
     {
        items.push('eq(xid,'+this[ i].getDataPointWrapper().xid+')');
     }
     //Build RQL query
     rql+=items.join(',') + ')';
     
     //get configs of all of these points
     var dataPoints=JSON.parse(JsonEmport.dataPointQuery(rql)).dataPoints;
     var ptMap={};
     //Iterate through to get the rendered values
     for(var i=0;i<dataPoints.length;i++)
     {
        ptMap[ dataPoints[ i ].xid ] = {};
        if(dataPoints[i ].textRenderer.type==="BINARY")
        {
            //Set Binary renderedValues
            ptMap[ dataPoints[ i].xid ][0] = dataPoints[ i].textRenderer.zeroLabel;
            ptMap[ dataPoints[i ].xid ][1] = dataPoints[i ].textRenderer.oneLabel;
        }
        else if(dataPoints[i ].textRenderer.type==="MULTISTATE")
        {
            //Or get the multistate values
            for(var j=0;j<dataPoints[i ].textRenderer.multistateValues.length;j++)
            {
                ptMap[ dataPoints[i ].xid ][dataPoints[ i].textRenderer.multistateValues[j].key] = dataPoints[ i].textRenderer.multistateValues[j].text;
            }
        }
     }
     //Print here just to show format of mapping. Can comment out.
     print(JSON.stringify(ptMap) ); //so ptMap[xid][ ptValue ] => renderedValue
     
    

    Fox

    posted in Dashboard Designer & Custom AngularJS Pages read more
  • MattFox MattFox

    Yes, limit is set to 100 by default. Same goes for datapoints. Try limit=-1 as a parameter. I believe will tell it to pull all.

    Use swagger to test your api calls.

    Fox

    posted in User help read more
  • MattFox MattFox

    Look at this code for a script which fires an email using the email handler directly:
    https://forum.mango-os.com/topic/3147/email-last-day-s-events/2

    You should either use freemarker markup ie <#if value == 1>Alt</#if>
    or append to your freemarker object the renderedValue for each item as you iterate through them at the given time.

    model.put("p1",p1.value)

    model.put("p2",p2.value)

    However, looking at above, you're 'putting' p1.value, not p1.renderedValue
    EDIT: that might actually be .rendered not renderedValue!
    Try that first and if no luck then perhaps building on a script that gives a better defined message using pointLocator data inside the datapoint itself for multistate values.

    Fox

    posted in Dashboard Designer & Custom AngularJS Pages read more
  • MattFox MattFox

    In order to help you a little more here without confusing you in the process... Can you explain what you want to trigger the event and thus send the email?

    You can send an alert based upon value thresholds being crossed or no change in value or no updates for a period of time.

    If however you mean how you render the data, perhaps looking at writing a .ftl file will be a better port of call. Can show you how to assemble a model and map all affiliated values as desifed withba script...

    After that happy to walk you through the process.

    Fox

    posted in Dashboard Designer & Custom AngularJS Pages read more
  • MattFox MattFox

    Refer to your other post, I left an update there should that help you

    Fox

    posted in Mango General read more
  • MattFox MattFox

    Don't you need an extension to do that? Meaning you'd have to be able to change source code to or at least have additional settings available to run PHP inside apache tomcat? Let me know, I'd be keen to know.

    MANGODIR/overrides/web/modules/mangoUI/web/ 
    

    as far as I know is the web host directory so you don't lose changes with upgrades. But then again that's for just running straight .html I suppose. Not sure if that would work for you.

    Other than that I guess you'd need @terrypacker to answer this one unless another Java dev is readily available...

    Fox

    posted in User help read more
  • MattFox MattFox

    Just to build on your other post, if your params are dynamically generated, meaning they can be anything other than a fixed set of params,
    inject $window into your controller and spkit the url up with

    $window.location.href
    

    split by ?, then & then = to get your key-value pairs.
    Yes its dodgy, but as long as you have proper error handling I cannot see it being an issue.

    Fox

    posted in Dashboard Designer & Custom AngularJS Pages read more
  • MattFox MattFox

    Just had a thought, thinking about something I did recently... I didnt care much for params since I had my own components doing the heavy lifting.. So I used the $state provider and pulled in the url, split by / then use what was on the end. Why dont you do the same with the ? and the &? Then split each result by = for your key value pairs and run as needed. Just one of those shower thoughts haha.

    EDIT: Nope sorry, completely ballsed that one up. If you want your params, add to the menu item: ?item1&item2
    Do not add = in your menu link. Just do that and your stateparams will be available.
    ie: your menu link will be.

    /mycomponentpage?thisDevice&thatvalue&anotherkey
    

    Your $state.params will be

    {
    thisDevice: '',
    thatvalue:'',
    anotherkey:''
    }
    
    

    Fox

    posted in Mango General read more
  • MattFox MattFox

    Sorry am a little overrun, however, this is their dashboard repo.
    https://github.com/infiniteautomation/ma-dashboards/tree/3.7.x

    This should shed some light on how their stateparams work

    Fox

    posted in Mango General read more