how compare the array and remove the similar values, using Code unit.
When compare ArrayA and ArrayB, how can i remove duplicates.
I’m not quite sure what you ask.
But if it’s a simple array you could do it like this.
Define a record-variable, that has a primary key that matches your array.
remember to define it as a temporary record variable.
Now you can loop through the array, and try to insert the array-value in the record-var.
If this is not a succes, it’s because the value already has been inserted (from another dimension in the array), and the actual dimension in the array can be cleared.
To my knowledge there is no way to simply compare 2 arrays.
(but i’m up for new knowledge if anyone knows better)
Quite simple procedure:
txArr (TEXT(30) ARRAY of 11
txArr[ 1] := ‘a’;
txArr[ 2] := ‘b’;
txArr[ 3] := ‘c’;
txArr[ 4] := ‘d’;
txArr[ 5] := ‘g’;
txArr[ 6] := ‘a’;
txArr[ 7] := ‘f’;
txArr[ 8] := ‘g’;
txArr[ 9] := ‘t’;
txArr := ‘x’;
txArr := ‘b’;
FOR i := 1 TO ARRAYLEN(txArr) - 1 DO
FOR j := i + 1 TO ARRAYLEN(txArr) DO BEGIN
IF txArr[i] = txArr[j] THEN
txArr[j] := ‘’;
x := COMPRESSARRAY(txArr); //x is the number of non-empty elements