Switch to desktop version  
LOGIO on tag group - Printable Version

+- Ewon Technical Forum (https://techforum.ewon.biz)
+-- Forum: Development (https://techforum.ewon.biz/forum-50.html)
+--- Forum: BASIC Script (https://techforum.ewon.biz/forum-52.html)
+--- Thread: LOGIO on tag group (/thread-1120.html)



LOGIO on tag group - Cst - 04-12-2019

Dear,

As we can associate a tag to a tag group and activated the historic log for each, instead of declare one ONCHANGE ligne for each tag we want to log:

ONCHANGE "Tag_name" ,"LOGIO 'Tag_name'"

Is there a way to activate the ONCHANGE not for a tag but for a tag group ?
Like 
ONCHANGE "Tag_group",  "LOGIO 'Tag_group'"

Thanks,


RE: LOGIO on tag group - simon - 04-12-2019

Hi,

First the LOGIO function for a group of Tags exist. It is called LOGGROUPIO. See https://developer.ewon.biz/system/files_force/rg-0006-01-en-basic-programming.pdf?download=1

If you want to make a ONCHANGE on multiple Tags, you have to loop :
n% = GETSYS PRG,"NBTAGS"

For i%=0 To n%-1
SETSYS TAG, "LOAD", -i%
GroupA% = VAL GETSYS TAG, "IVGroupA"
IF GroupA% = 1 THEN //in Group A
name$= GETSYS TAG, "NAME"
PRINT name$
ONCHANGE -i%, 'PRINT "TAG '+name$+' has changed"'
ENDIF
Next i%

Simon
Simon


RE: LOGIO on tag group - Cst - 05-12-2019

(04-12-2019, 05:07 PM)simon Wrote: Hi,

First the LOGIO function for a group of Tags exist.  It is called LOGGROUPIO. See https://developer.ewon.biz/system/files_force/rg-0006-01-en-basic-programming.pdf?download=1

If you want to make a ONCHANGE on multiple Tags, you have to loop :
n% = GETSYS PRG,"NBTAGS"

For i%=0 To n%-1
  SETSYS TAG, "LOAD", -i%
  GroupA% = VAL GETSYS TAG, "IVGroupA"
  IF GroupA% = 1 THEN //in Group A
    name$= GETSYS TAG, "NAME"
    PRINT name$
    ONCHANGE -i%, 'PRINT "TAG '+name$+' has changed"'
  ENDIF
Next i%

Simon
Simon

Thanks Simon,

But with this loop  program , no reason to use the LOGGROUPIO with the ONCHANGE, we have to complete your program with:

n% = GETSYS PRG,"NBTAGS"

For i%=0 To n%-1
  SETSYS TAG, "LOAD", -i%
  GroupA% = VAL GETSYS TAG, "IVGroupA"
  IF GroupA% = 1 THEN //in Group A
    name$= GETSYS TAG, "NAME"
    PRINT name$
    ONCHANGE -i%, "LOGIO 'i%'" 
  ENDIF
Next i%

no ?
Other question,  what does it means to add a '-' in front of i%, on the ONCHANGE Line ?



RE: LOGIO on tag group - AngelaT - 06-12-2019

Using a number less than or equal to 0 lets you access the tag by its index (first tag, second tag, etc). If i is a number greater than 0, then the number is assumed to be the tag id which might not be sequential.


RE: LOGIO on tag group - Cst - 09-12-2019

(06-12-2019, 04:31 PM)AngelaT Wrote: Using a number less than or equal to 0 lets you access the tag by its index (first tag, second tag, etc).  If i is a number greater than 0, then the number is assumed to be the tag id which might not be sequential.
The following line is not correct:
ONCHANGE -i%, "LOGIO 'i%'" 

How do I need to write it in order to launch the LOGIO of the tag when this tag change ?
I've try a lot of combinaison without success....

ONCHANGE name$, "LOGIO 'name$'" 
[b][font=Tahoma, Verdana, Arial, sans-serif]ONCHANGE name$, 'LOGIO "name$"'
...
.
 
[/b][/font]



RE: LOGIO on tag group - simon - 09-12-2019

Hi,

Can you try
ONCHANGE -i%, "LOGIO -" + STR$ i%
?

Simon


RE: LOGIO on tag group [SOLVED] - Cst - 10-12-2019

(09-12-2019, 02:44 PM)simon Wrote: Hi,

Can you try
    ONCHANGE -i%, "LOGIO -" + STR$ i%
?

Simon

Simon,
Works fine :-)
thanks