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.
Scripting Data Source to create a parameter
-
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
-
@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: falseIn the script enter:
target.set( source.value)
Fox
-
@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 -
@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 valueAlso, fantastic news on your progress. I'm always about and happy to assist if you need me. Email is fine too!
Fox