• Recent
    • Tags
    • Popular
    • Register
    • Login

    Please Note This forum exists for community support for the Mango product family and the Radix IoT Platform. Although Radix IoT employees participate in this forum from time to time, there is no guarantee of a response to anything posted here, nor can Radix IoT, LLC guarantee the accuracy of any information expressed or conveyed. Specific project questions from customers with active support contracts are asked to send requests to support@radixiot.com.

    Radix IoT Website Mango 3 Documentation Website Mango 4 Documentation Website Mango 5 Documentation Website

    Scripting Data Source to create a parameter

    User help
    2
    4
    350
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • BGB
      BG
      last edited by BG

      Hello all,
      In Mango 3.7.12, Can anyone tell me how to write a script in the Scripting Data Source that would create a parameter that can then be picked up by a SQL Data Source script to use for setting a value in the MySQL database table?

      This to replace the Point Links feature where the source and target were from drop down lists.

      Cheers

      Brian

      MattFoxM 1 Reply Last reply Reply Quote 0
      • MattFoxM
        MattFox @BG
        last edited by

        @BG the context points I mentioned in your other post where the source point is the context point that updates the context is ticked, the target is a context point that you set the value with the value of the source point.

        Point 1, variable name: source, updates context: true
        Point 2, var name: target, updates context: false

        In the script enter:
        target.set( source.value)

        Fox

        Do not follow where the path may lead; go instead where there is no path.
        And leave a trail - Muriel Strode

        BGB 1 Reply Last reply Reply Quote 0
        • BGB
          BG @MattFox
          last edited by BG

          @MattFox Hello Matt,
          Thank you very much for spelling that out to me.
          Here's the rub though.

          I am trying to use a timestamp to update an integer. So on validation I got this message:

          Setting point 0100raw - 0100-zflag to 2024-03-14 09:20:00.0 @ 12 Apr 2024 07:54:01 UTC

          What I really need is the parameter to set a 1 when the timestamp updates.
          In the old point links I had a simple line,

          Return '(1)';

          So I tried something actually quite simple once you know. I left the timestamp as the update context and used this script:

          target.set('(1)')

          I assumed that the example Phil put on the forum all those years ago required me to assign the target and source point in the script code.

          Sometime I can't see the forest for the trees.

          So HUGE THANKS Matt. I can now get my system running and I now know how to take it into Mango 4 hopefully.

          Cheers
          Brian

          MattFoxM 1 Reply Last reply Reply Quote 1
          • MattFoxM
            MattFox @BG
            last edited by MattFox

            @BG meta are virtual datapoints that can return a value. Scripting datasource scripts are functions that run an alert or can send/set data to a variety of destinations. The benefit of a scripting datasource though is it doesn't cost you your datapoint count.
            But do note that because it's a datasource, it doesn't retain a value

            Also, fantastic news on your progress. I'm always about and happy to assist if you need me. Email is fine too!

            Fox

            Do not follow where the path may lead; go instead where there is no path.
            And leave a trail - Muriel Strode

            1 Reply Last reply Reply Quote 0
            • First post
              Last post