¿ªÔÆÌåÓý

ctrl + shift + ? for shortcuts
© 2025 Groups.io

Array Index Question


 

Can someone explain why this always returns 1

PUSH Update_Names
{
Print("%s", NewNames[Getlastmodifiedarrayindex()]);
}

and this returns a proper index value

CHANGE NewNames
{
Print("%s", NewNames[Getlastmodifiedarrayindex()]);
}


 

¿ªÔÆÌåÓý

Is Update_Names an array? Do you have more than one input array?

?

If no to the first question and yes to the 2nd see the SIMPL+ help ¡°NOTE: ?Using GetLastModifiedArrayIndex OUTSIDE of an event (PUSH, RELEASE, CHANGE or EVENT) may return an index to an ambiguous signal if more than one input array is declared within the program. ?Therefore, do not use this function if more than one input signal array is declared within the program, unless you use it within one of the event statements.¡±

?

Aside from that note I don¡¯t think it is generally best practice to use GLMAI outside of the event for the array in question, particularly because the GLAMI value is safe within the event function and not so outside (e.g. if two different indexes change on the same wave you will fire two CHANGEs but GLAMI might not be the value you expect. I also wouldn¡¯t be surprised if at some point since that help text was written and today the something under the hood got changed such that all inputs get treated as an array of one element.

?

--

Lincoln King-Cliby, CTS, DMC-E-4K/T/D
Commercial Market Director
Sr. Systems Architect | Crestron Certified Master Programmer (Diamond)
ControlWorks Consulting, LLC
Direct: (+1)440.771.4807 | Cleveland: (+1)440.449.1100? | Boston: (+1)508.695.0188 | DC: (+1)202.381.9070? | Fax: (+1)440.449.1106
Crestron Services Provider | Biamp Authorized Independent Programmers | Extron Qualified Independent Programmer

?

From: [email protected] [mailto:[email protected]] On Behalf Of Crestron_Programmer
Sent: Friday, August 06, 2021 8:52 AM
To: [email protected]
Subject: [crestron] Array Index Question

?

Can someone explain why this always returns 1

PUSH Update_Names

{

Print("%s", NewNames[Getlastmodifiedarrayindex()]);

}

and this returns a proper index value

CHANGE NewNames

{

Print("%s", NewNames[Getlastmodifiedarrayindex()]);

}


 

Hi Lincoln,

No?Update_Names? is a single digital input. There are no other arrays in this module. I'll work around it but I think this behavior is a little strange.

Thank you


 

It¡¯s digital versus analog. Digital is either 1 or 0. A PUSH is only gonna be high or low. A CHANGE is analog and can be any number.

On Fri, Aug 6, 2021 at 11:48 AM Crestron_Programmer <s.marszalek11@...> wrote:
Hi Lincoln,

No?Update_Names? is a single digital input. There are no other arrays in this module. I'll work around it but I think this behavior is a little strange.

Thank you

--

Caleb Godfrey CTS
Systems Programming Engineer | Control Systems Programming and AV over IP
775 Barber St. Athens, GA 30601
Office: +1.706.613.8759 x8208
Fax: +1.706.243.4940
Cell: +1 706.540.7938
Direct: +1 706.534.7308
calebgodfrey@...

This email and its contents are intended for?employees, contractors, and clients of TSAV only. It contains information which may be confidential, privileged and/or exempt from disclosure. Unless you are authorized you may not read, copy, use, or disclose the message and/or its attachment(s) or its contents. The unauthorized use, copying or disclosure of this email and/or its attachment(s) or its contents is strict


 

If Update_Names is a single digital input, then GetLastModifiedArrayIndex() will not return a usable value within its event handler.? It is only defined for use with array signals.


On Fri, Aug 6, 2021 at 11:48 AM Crestron_Programmer <s.marszalek11@...> wrote:
Hi Lincoln,

No?Update_Names? is a single digital input. There are no other arrays in this module. I'll work around it but I think this behavior is a little strange.

Thank you


 

¿ªÔÆÌåÓý

You can use a CHANGE on a digital ¨C it will capture the rising and falling edges ¨C it allows you to capture the PUSH and RELEASE in the same event, e.g. if you¡¯re relaying a digitals state to S# or want to do the same thing when the signal changes vs. only on rising edge or falling edge.

?

A PUSH will only trigger in response to the rising edge (0->1) of a digital signal

A RELEASE will only trigger in response to the falling edge (1->0) of a digital signal

A CHANGE will trigger in response to either 0->1 or 1->0 of a digital signal or the value of an analog or serial changing.

?

--

Lincoln King-Cliby, CTS, DMC-E-4K/T/D
Commercial Market Director
Sr. Systems Architect | Crestron Certified Master Programmer (Diamond)
ControlWorks Consulting, LLC
Direct: (+1)440.771.4807 | Cleveland: (+1)440.449.1100? | Boston: (+1)508.695.0188 | DC: (+1)202.381.9070? | Fax: (+1)440.449.1106
Crestron Services Provider | Biamp Authorized Independent Programmers | Extron Qualified Independent Programmer

?

From: [email protected] [mailto:[email protected]] On Behalf Of Caleb Godfrey via groups.io
Sent: Friday, August 06, 2021 11:52 AM
To: [email protected]
Subject: Re: [crestron] Array Index Question

?

It¡¯s digital versus analog. Digital is either 1 or 0. A PUSH is only gonna be high or low. A CHANGE is analog and can be any number.

?

On Fri, Aug 6, 2021 at 11:48 AM Crestron_Programmer <s.marszalek11@...> wrote:

Hi Lincoln,

No?Update_Names? is a single digital input. There are no other arrays in this module. I'll work around it but I think this behavior is a little strange.

Thank you

--


Caleb Godfrey CTS
Systems Programming Engineer | Control Systems Programming and AV over IP
775 Barber St. Athens, GA 30601
Office: +1.706.613.8759 x8208
Fax: +1.706.243.4940
Cell: +1 706.540.7938
Direct: +1 706.534.7308
calebgodfrey@...


This email and its contents are intended for?employees, contractors, and clients of TSAV only. It contains information which may be confidential, privileged and/or exempt from disclosure. Unless you are authorized you may not read, copy, use, or disclose the message and/or its attachment(s) or its contents. The unauthorized use, copying or disclosure of this email and/or its attachment(s) or its contents is strict


 

Ok, so it's working as expected. Thank you, guys!