• 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
  • MattFox MattFox

    What's your controller?
    Paste all code here. May as well look at what you are doing.
    Are you extending with the userModule?

    posted in Mango General read more
  • MattFox MattFox

    As I said, read the help docs, create a watchlist with query as the type and add your parameters in there. Leverage them with the stateparams and apply them to the watchlist lookup

    https://docs-v3.mango-os.com/linking-to-dynamic-pages

    Fox

    posted in Mango General read more
  • MattFox MattFox

    @himanshu said in How we can filter the json and dynamically pass the data to create multiline chart in mango automation:

    toilet=TSTE-H2&dp=Temperature&dp=State&type=shioiaq2

    I suggest you change dp to dp1 and dp2. By using dp twice you overwrite the parameter.

    Secondly, have you read this help doc?

    https://docs-v3.mango-os.com/dynamic-floor-plan

    Only out with my phone at the moment so I dont have an active mango instance handy! Only whats in my head...
    That doc explains how to attach params to components in the dashboard.

    Fox

    posted in Mango General read more
  • MattFox MattFox

    Anytime, well done and good luck. Always here if needed.

    Fox

    posted in Mango General read more
  • MattFox MattFox

    Ok first up. Show all of your markup in code tags. First it appeared you were trying to derive values from what you had stored in datapoints. I see you were confused and actually meant its JSON store data for a watchlist.
    Use ma point query and build a RQL query using the watchlist builder. This way you can pull only what you want.

    <ma-point-query query="'and(eq(name,Temperature),eq(tags.Sensor Type,shioiaq2))&limit(2)'" points="tmpPts"> </ma-point-query>
    
    <div ng-repeat="pt in tmpPts">
    <ma-point-values .... >
    
    <ma-serial-chart .... >
    </div>
    
    

    Once you markup is visible we can get rid of your digest error.

    Fox

    posted in Mango General read more
  • MattFox MattFox

    If that is the case I recommend using a meta data source.
    Use this datapoint as the context point and return the temperature value after decoding it with JSON.parse
    Sort through the object and as said before, return the temperature value.

    The meta point can then be used to populate your charts. Hope that helps!
    Although, what is you actual value? I do not see anything numerical
    Fox

    posted in Mango General read more
  • MattFox MattFox

    Can you show me the format of your data? I wrote a component to help another user format their data from JSON to the structure required by the amcharts to work as desired.
    Might be worth looking up what I did and see if aligns with your work.

    Fox

    posted in Mango General read more
  • MattFox MattFox

    Yes, use the flex attribute - some of card examples show how it works. Just replace their md-cards with divs.
    Read up on angularJs material's flex. Or read up on using CSS grid on how to put components in the centre. css tricks has an excellent tutorial.
    Sorry don't have time right now to give you a complete example.
    Can always do so later tonight.

    Fox

    posted in Mango Automation general Discussion read more
  • MattFox MattFox

    use viewport width.

    height:0.3vw;
    

    Fox

    posted in Mango Automation general Discussion read more
  • MattFox MattFox

    Version 2 and version 3 are two completely different versions of mango. You will have to pay for a license upgrade or a new license depending on the ts&cs

    Fox

    posted in MangoES Hardware read more