ArrayArrayArrayArrayArray
CODE: Statistics: Posted by senso — 26 Nov 2017, 12:28
But here is a workaround :////////////////////////////////////////////////////// Check if a value is in the array/////////////////////////////////////////////////////var Arr, Found, Valsearch : Tparameter;Procedure Init;BEGIN Arr := CreateParam('ArrayIn',PtArray); setisOutput(Arr,false); ValSearch := CreateParam('Value to search',PtDataField); setisOutput(Valsearch,false); setvalue(valsearch,1); Found := CreateParam('value found',PtSwitch); setisInput(Found,false);END;//////////////////////////////////////////////////////////////////////Procedure Callback (n: integer); // Scan the N inputs, and n pick the index of any input that changed to // return result in same bloc.var valFound : boolean; // "is our value found?" is a boolean = binary choice TRUE or FALSE type // of variablevar i : integer; // integer used to scan thru the array elements.BEGIN // Start the callback = check inputs changesIF (n=Arr) then begin // if changes on Arr input, start i := 0; // reset i (=index to scan) valfound:=FALSE; // by default the value is not found while ((not valFound) and (i < GetLength(arr))) do begin // do the check for each elmt among array // length as long as value isn't found if (GetDataArrayValue(arr, i) = getvalue(Valsearch) ) then valFound := TRUE;// boolean result of the check we want to do ,// if valfound then itrace(i); // TRUE if the array elmt(i) = our input value i := i + 1; // increment the scanned elmt end; if valfound then begin //if the result of valfound is true, we set parameter to 1 setvalue(Found,1); end else begin //otherwise we set it to 0; setvalue(Found,0); end; END; //end of subchec end;
]]>
Statistics: Posted by 23fx23 — 25 Nov 2017, 04:37
Statistics: Posted by CREDO — 24 Nov 2017, 22:50
CODE:
////////////////////////////////////////////////////// Check if a value is in the array/////////////////////////////////////////////////////var Arr, Found, Valsearch : Tparameter;Procedure Init;BEGIN Arr := CreateParam('ArrayIn',PtArray); setisOutput(Arr,false); ValSearch := CreateParam('Value to search',PtDataField); setisOutput(Valsearch,false); setvalue(valsearch,1); Found := CreateParam('value found',PtSwitch); setisInput(Found,false);END;//////////////////////////////////////////////////////////////////////Procedure Callback (n: integer); // Scan the N inputs, and n pick the index of any input that changed to // return result in same bloc.var valFound : boolean; // "is our value found?" is a boolean = binary choice TRUE or FALSE type // of variablevar i : integer; // integer used to scan thru the array elements.BEGIN // Start the callback = check inputs changesIF (n=Arr) then begin // if changes on Arr input, start i := 0; // reset i (=index to scan) valfound:=FALSE; // by default the value is not found while ((not valFound) and (i < GetLength(arr))) do begin // do the check for each elmt among array // length as long as value isn't found if (GetDataArrayValue(arr, i) = getvalue(Valsearch) ) then valFound := TRUE;// boolean result of the check we want to do ,// if valfound then itrace(i); // TRUE if the array elmt(i) = our input value i := i + 1; // increment the scanned elmt end; if valfound then begin //if the result of valfound is true, we set parameter to 1 setvalue(Found,1); end else begin //otherwise we set it to 0; setvalue(Found,0); end; END; //end of subchec end;Statistics: Posted by senso — 26 Nov 2017, 12:28
Statistics: Posted by 23fx23 — 25 Nov 2017, 04:37
Statistics: Posted by CREDO — 24 Nov 2017, 22:50