I have created an array and now I try to make searches in the array with no luck. I can't figured out what is wrong my code. Every time when I trig the search i get a status value below zero which indicates an error.
I have tested the array with "GetArray" function so I know I have values in the array. I have created a datatype (PlateID) with two elements ID = dword and Working order = dint.
I can't figured out why it's not possible to make search.
Below is the code I'm testing with.
(* Search for working order *)
(* Set search id *)
SearchID.ID := testID; --> test value
If StartSearch Then
StartSearch := False;
sIndex := 0;
ComponentFound := SearchArray( Array := MyArray,
SearchIndex := sIndex,
SearchCount := 5,
SearchElement := SearchRec, --> PlateID
SearchComponent := SearchID.ID, --> element in PlateID
FoundElement => HitRecord, --> PlateID
Status => SearchStatus );
If SearchStatus > 0 then
HitWo := HitRecord.WorkOrder;