How to Manage A Variable

Hi

I am looking for a way to put in a countdown Counter on displays .

I have created a variable CountDown=138

At 00:01 I want to reduce that by 1 so would normally do something like

$CountDown=$CountDown-1

How do I do this in Sharptools?

Hi @Michael_Horton, math functions are not currently supported yet, but please cast your vote to this existing feature request, so it helps to get prioritized.

No problem - with your help I can do math functions in HE and export to Sharptools for display

1 Like

@James I have successfully sent a number to Sharptools from HE and it is received by Sharptools as a string so I can display it easier on a dashboard.

I have replicated it for sending Alert Messages to put on the Dashboard.

Unfortunately ONLY numbers are received in ST and displayed in Dashboard - the Number is showing as Text because I am displaying as Text to get bigger text on dashboard.

The AlertMessage variable is defined in HE as a String

I can see HE sending the variable to ST but can’t see ST receiving it.

Can you advise please?

@Michael_Horton, does the string message sent from HE have space in it? My guess is the string variable attached as the query parameter doesn’t get URL encoded and the space in the string caused the problem. (Just tested enabling the URL Encode option, but it doesn’t work for the query parameter.)

So you will have to change the action from Send HTTP GET to Send HTTP POST, and include the variable in the body to avoid the encoding issue. See the screenshot for example below where I added %MyText% in the body section in JSON format.

This should work for you.

1 Like

@James Thank you so much for all your help - your documentation is fantastic - thanks

2 Likes

Ok got around to trying this

From the HE Logs I can see

app:2352021-04-16 14:00:44.530 infoAction: Send POST to: https://trigger.sharptools.io/rule/ptKuAugvhPEIxGVQYzqw/key/xxxxxxxxxxxxxxxxxxxxxxxxccf -->(json) body: {“value”:“%Alert-Message%”

And Sharptools setting is :-1:

What am I messing up?
Thanks

It’s missing the closing } bracket.

{"value": "%Alert-Message%"}
2 Likes

You are a STAR!!! @josh and VERY MUCH APPRECIATED!!!

Would be VERY NICE indeed if this were a little less geeky to get going, a smidgeon?

Thanks guys!

1 Like

I tried the HTTP GET action in Rule Machine to a test service (https://requestbin.com/) and it didn’t work when I had a variable in the URL. The rule logs acted like it was sending the request, but it never actually got sent.

Not sure if it’s a bug or what. Either way, the POST action worked.