Computed Tags in Groov

I’m working on setting up a computed tag in groov view and was wondering if it supports 64 bit integers? I’ve done a simple script to select between two 64bit integers based on the true/false of a 32bit integers and it doesn’t seem to work. I was wondering if the 64bit integers was throwing it off.
The script is:
function evaluateTag(input1, input2, input3) {
let output = selectVariable(input3, input1, input2);
return output;

Does anyone have any ideas? I’m not used to java so I’m not sure if the syntax is wrong.

Great question!
Might have to hang on a bit to get an answer.
@torchard is teaching class today (we run a training class here at Opto every 4-6 weeks).
I think @Jonathan_Fischer might be around to take a quick look.

The Computed Tags run JavaScript, not Java. There’s only one number type in JavaScript, the 64-bit IEEE 754 floating point type.

You can safely use integers that fit into the 53-bit range before you start losing precision. I’m not sure what your selectVariable function there is going to do; we don’t currently have a way for you to define a function somewhere and use it in other computed tags.

2 Likes

It doesn’t seem to work. I was trying to pull a status variable from two separate controllers and swap them based on another tag from the second controller. The output would be tagged to a gadget.

So something like:

function evaluateTag(input1, input2, input3) {
  if (input3) {
    return input1;
  } else {
    return input2;
  }
}
1 Like

That’s what I ended up with Jonathan which does work. Also, is there any plan in Groov to be able to logout using a button gadget? I’ve had to set users in kiosk mode to remove the menu bar at the top of the screen because the text was too small on it and I couldn’t find any way to make it bigger. It didn’t meet spec for text size. I have to make a decision soon on either using Groov or PAC Display and logging in and out is a requirement.

Getting off topic, might move it, but just use the REST API to log out?

Put your button gadget in groov View, link it to an MMP scratch pad address.
In Node-RED check the MMP address, when true, fire off a HTTPS request to the log out end point: manage/api/ui/auth/#/user/logoutCurrentUser

image

Should be a 5 minute setup.

UPDATE! This is wrong. Read further down.

1 Like

Ben, I’m not that familiar with node red but I’ll look into it. Is there any documentation you can point me to?

Here you can find many Node-RED related videos. Especially the section “Getting Started with Node-RED on groov” might be interesting to you.
https://opto22.com/support/resources-tools/videos/playlist-node-red-workshops

If you have shell and know python, that would work just as well.
The key is to write the groov View button gadget to the MMP address.
Once its there, you can use lots of different things to read that value change and make the RESTful API call.

@tjcrusher I’ve just had word from the software guys here at Opto that this will not work the way I thought it would.
Its a groov View API call vs a groov Manage or global API call.

In other words, it will not work the way I said. Its a bit of an unusual API call actually. I am going to kick a few rocks over and dig a bit deeper actually.

Bottom line, not sure how to achieve a log out.