Returns the key of the closest matching numerical column value in the dictionary. The key is returned as a string so that it can be used in a nested call that reads a cell value.
string FindClosestDicKeyByCol(string dictionaryName, string columnName; double value; [int closestHigherOrLower])
dictionaryName |
The name of the dictionary to find the closest key in. |
columnName |
The name of the dictionary column to search. |
value |
The value to find the closest match for. |
closestHigherOrLower |
Optional filter. Find closest key = 0, Find closest higher or equal key = 1, Find closest lower or equal key = -1 |
Examples
FindClosestDicKeyByCol("Size"; "Height"; 2.5; 1)
Returns the key of the row with the "Height" column value that is closest higher or equal to 2.5 in the dictionary "Size".
Remarks
This method requires that the keys and referred column of the dictionary are numerical or can be converted to double using "NumberFormatInfo.InvariantInfo".