EVENT TRIGGER

Hello everyone, could you help me with this query
In the plc varaibels and in the ewon tags I have these two variables declared (Good_Units_BB and Presentation_BB) but I need to create an event trigger normally I would do it with the ONCHANGE function but having two variables that can change at the same time as I would I should use another function which one?
I publish a part of the code

@ Var_int3 (“packaging-units”, Good_Units_BB @, “3”, Presentation_BB @)
ONCHANGE “TRIGGER”, ‘Var_int3 (“packaging-units”, Good_Units_BB @, “3”, Presentation_BB @)’

What is the goal of this function?

Could you show us what the rest of the code looks like?

This code is to send data to an API.
The help I’m looking for when creating a route
@ Var_int3 (“packaging-units”, Good_Units_BB @, “3”, Presentation_BB @)
I have to declare two variables Good_Units_BB and Presentation_BB these variables have values ​​that will change the idea is that every time they change a trigger, send this change, normally it has been working with the ONCHANGE function that works well when there is only one variable that presents instead but when there are two or more variables that can change in the error path

the part of code in which I do this is
// ---------------------------------- UNITS FULL ------------ ------
@ Var_int3 (“packaging-units”, Good_Units_BB @, “3”, Presentation_BB @)
// ------------ CHANGES UNITS FULL ------------------------------
ONCHANGE “TRIGGER”, ‘Var_int3 (“packaging-units”, Good_Units_BB @, “3”, Presentation_BB @)’
In the ONCHANGE function there is the TRIGGER that works detecting the changes in the variable (Good_Units_BB and Presentation_BB) but this route has two variables and the ONCHANGE only works for me to detect the change in a single variable as I do the detection of the change in two variables.

NOTE WHEN I REFER TO THE TRIGGER, IT IS THE VARIABLE THAT WHEN IT SHOWS A CHANGE, THE SHIPPING IS MADE

HANDBOOK

ONCHANGE
Syntax
ONCHANGE S1, S2
S1 the tag reference (tag name, ID or index).
S2 the command line to execute in case the tag value or configuration changes.
Description
This command executes the S2 command line when the tag S1 changes. The change can be
its value or configuration. The EVTINFO parameter is set to the tag ID when command is called.
ONALARM will execute the command when the alarm status gets the value “2” (or above)
which means that ONALARM does not detect the “pre trigger” status (value = 1).

I PUBLISH THE CODE

// ---------------------------------- UNITS FULL ------------ ------
@ Var_int3 (“packaging-units”, Good_Units_BB @, “3”, Presentation_BB @)
// ------------ CHANGES UNITS FULL ------------------------------
ONCHANGE “TRIGGER”, ‘Var_int3 (“packaging-units”, Good_Units_BB @, “3”, Presentation_BB @)’

Function SendInfo ($ Info $, $ api $)
URL $ = “https://dataplc.smartessi.com/api/” + $ api $ + “?”
T $ = Time $
year $ = T $ (7 To 10)
mon $ = T $ (4 To 5)
date $ = T $ (1 To 2)
hour $ = T $ (12 To 13)
min $ = T $ (15 To 16)
sec $ = T $ (18 To 19)
fff $ = year $ + “-” + mon $ + “-” + date $
hour $ = hour $ + “:” + min $ + “:” + sec $
// --------------- PRINTING THE PATH URL + DATA -------------------------
endpoint $ = URL $ + $ Info $
PRINT endpoint $
REQUESTHTTPX endpoint $, “POST”, “Content-Type: application / json; charset = utf-8”
ENDFN
// -------------------------------- UNITS FULL -------------- --------
Function Var_int3 ($ api_int $, @ $ Val_Var_int, $ head_id $, @ $ Val_Var_int2)
AR_I3 $ = SFMT $ Val_Var_int, 30, 0, “% d”
AR_I32 $ = SFMT $ Val_Var_int2, 30, 0, “% d”
DataR_I3 $ = “value =” + AR_I3 $ + “& id_head =” + $ id_head $ + “& presentation =” + AR_I32 $ + “& date =” + fff $ + “& time =” + time $
@SendInfo (DataR_I3 $, $ api_int $)
ENDFN

Could you just use two different Onchange functions and have them both point to the same area? What errors are you getting when you run your code?

Could you give me an example of how it would look


The code runs fine, but when you start to record the changes in Good_BB_Units (Unidades_Buenas_BB) and presentation_BB (presentacion_BB), you get an error

Hi Carlos, If you click on the error in the command prompt it will show you which line is getting the error. Is that line calling a function or what is it doing?