Choose Language Hide Translation Bar
Community Manager

## Re: How can the comparison result be obtained directly without adding auxiliary columns？

Here's yet another approach. This one uses matrices. It makes some assumptions between the matrices and data tables but hopefully gives you enough to get started if you're interested.

``````Names Default To Here( 1 );

sourceTable = Data Table( "Trial1" );
resultsTable = Data Table( "Trial2" );

convertToMatrix = Function( {dt},
{Default Local},
mtrx = dt << get all columns as matrix;

numberOfColumns = N Col( mtrx );
For( i = 1, i <= numberOfColumns - 1, i++,
mtrx[0, i] *= 10 ^ (i - 1);
If( i > 1,
mtrx[0, i] = mtrx[0, i] + mtrx[0, i - 1]
);
);

mtrx[0, 1 :: numberOfColumns - 2] = [];
mtrx;
);

sourceMatrix = convertToMatrix( sourceTable );
resultsMatrix = convertToMatrix( resultsTable );

numberOfResults = N Row( resultsMatrix );

results = J( numberOfResults, 1, 0 );

For( i = 1, i <= numberOfResults, i++,
key = sourceMatrix[i, 1];
value = sourceMatrix[i, 2];
index = Loc( resultsMatrix == key ) + 1;
results[Floor( index / 2 )] = resultsMatrix[index] < value;
);

resultsTable << New Column( "Result", numeric, "continuous", values( results ) );``````
Highlighted
Community Trekker

## Re: How can the comparison result be obtained directly without adding auxiliary columns？

I'm going to try and learn how to do this memory array.Thank you very much!