Hi
I am stuck in trying to get my code search an array and retur an index number.
So, I have an array from 0 to 254 created from an UDT where I have a timer SP, a Timer ET, a scale of the timer and a manufactor item number like this.
Timer[0]
Timer_SP (DINT)
Timer_ET (DINT)
Scale (INT)
Item_NO (DINT)
Timer[1] And so on
What I am trying, is to make a small piece of SCL code that allows me to search my array for the item number and return the place number i my array (The value in []).
This is what I got so far:
FOR #Index := 0 TO 255 DO;
IF Array_DB.TIMER[#Index].Item_NO = #Value_to Search
THEN EXIT;
END_IF;
END_FOR;
Any suggestions
Best Regards
Brian
I am stuck in trying to get my code search an array and retur an index number.
So, I have an array from 0 to 254 created from an UDT where I have a timer SP, a Timer ET, a scale of the timer and a manufactor item number like this.
Timer[0]
Timer_SP (DINT)
Timer_ET (DINT)
Scale (INT)
Item_NO (DINT)
Timer[1] And so on
What I am trying, is to make a small piece of SCL code that allows me to search my array for the item number and return the place number i my array (The value in []).
This is what I got so far:
FOR #Index := 0 TO 255 DO;
IF Array_DB.TIMER[#Index].Item_NO = #Value_to Search
THEN EXIT;
END_IF;
END_FOR;
Any suggestions
Best Regards
Brian