Need urgent help in finding lowest unique value from a list- Please help!

Hi all,
In my database I have user inputted fields (numbers) and I am trying to display the lowest unique number.
For example when I display the text of all the values in the list I have the following:
1.1, 1.1, 1.12, 1.25

What I am trying to get would be 1.12 in this case (as it is the lowest value that does not have a duplicate (it’s count = 1, where the count of “1.1” = 2)

Please help!

How about:

  • set up a database field to hold the lowest unique number
  • when a number is created, trigger a backend workflow to write that number into the lowest unique number field only when:
    a) it is lower than the existing lowest unique number; and
    b) that new number is not in the existing list of numbers (this ensures it is a unique number)

However, there’s a complication. If a new number is input that equals the lowest unique number, then you would need to find the next higher unique number, which would be the new lowest unique number. To do this, you could run a recursive backend workflow to cycle through the list of numbers, sorted from low to high, to find the next lowest unique number.

This feels convoluted however, and someone may have a more elegant solution. Also I’m sure someone who knows some code would know how to write a plugin to do the calculation.

1 Like

First of all thank you very much!!! Given the urgency on the matter, I’ll give it a shot- this makes sense. will keep you posted!

Hi there, @rudycelekli… I probably wouldn’t call this suggestion elegant, but if I understand your post correctly, the expression I am about to suggest does seem to produce the desired result.

In my example, I have a field called num on the User data type. Here is the expression in a text element that gets the lowest num value across all users that is not a duplicate value.

There are no constraints on the search for users on the right, and here is the constraint on the search for users on the left.

Again, this suggestion might not be the best way to go (who knows, it might actually be the worst), but it does seem to work, so I didn’t think it could hurt to throw it out there as food for thought.

Best…
Mike

1 Like

Solution by @mikeloc appears much easier than mine!

Hi @mikeloc - this worked like magic!!! Thank you very much both to you and @ed727 for your help in this urgent matter. You guys rock!

2 Likes