Switch to desktop version  
Tags expressions - Printable Version

+- Ewon Technical Forum (https://techforum.ewon.biz)
+-- Forum: Development (https://techforum.ewon.biz/forum-50.html)
+--- Forum: Custom Web Pages/viewON/Talk2M Visualization (https://techforum.ewon.biz/forum-55.html)
+--- Thread: Tags expressions (/thread-1236.html)



Tags expressions - imbe88 - 07-04-2020

Hello everyone, I'm new in the forum.

is it possible in viewon or in the ewon tags page to build an expression with 2 or more tags?

For example:
TagZ=TagX-TagY

Thanks in advance for your answers


RE: Tags expressions - ziozetti - 08-04-2020

Hi imbe88!
Yes, it is possible in Basic script but "result tag" should be a MEM tag.
Syntax is something like:

TagMEM@ = Tag1@ - Tag2@

All tags have to be number type, otherwise you have to convert them.

You can find a lot of answers here: https://developer.ewon.biz/system/files_force/rg-0006-01-en-basic-programming.pdf


RE: Tags expressions - Jean-Yves - 09-04-2020

Hi

Hi,

With eWON basic script yes it's ok, it will be like

TSET 1,1
ONTIMER 1,"GOTO Calcul"
END
Calcul:
TagMEM@ = Tag1@ - Tag2@



This script is running at any time.

But if you want to do it in viewon it will be effective only when you display the page and you must use "JavaScript Sections"
In viewon you have 4 specific JAVA instruction to manage eWON tags

setEwonTagVal('tagName', value)
getEwonTagVal('tagName')

or Viewon tags

setViewOnTagVal('tagName', value)
getViewOnTagVal('tagName')

In your case it could like:

setEwonTagVal('TagMEM',getEwonTagVal('Tag1')-getEwonTagVal('Tag2'));


So in viewon



I think the eWON Basic script is better as it's working all time, but it depend on what you need exactly


RE: Tags expressions - imbe88 - 10-04-2020

perfect, you have been very clear!

So in the basic script I can also do more complex operations;
I should do something like this:

Every 1 second I would like to add the values of a variable:
TagMem1= TagMem1+(Tag1/3600)

Every first of the month:
TagMem1 transfer value to TagMem2
TagMem1 reset

it's possible?
is there a limit to the number of scripts i can add?


Thanks!!


RE: Tags expressions - Jean-Yves - 10-04-2020

Yes it's possible.

See this:
https://developer.ewon.biz/system/files_force/rg-0006-01-en-basic-programming.pdf

especially ONxxxx instruction, for your request ONDATE

And here the different example:
https://developer.ewon.biz/content/basic-1


The limit the memory allowed for the script it's 256 Kbytes.

Remarque as you are newbies with the script, never uses the Cyclic section.