1

I have a table with some repeated values in a field.

  1. Is it possible to assign some order value to the repeated values by creating a new field with values starting at one and consecutive integers for each repeated value? No predetermined order is necessary.
  2. Is it possible to establish an order related, for example, to the value of the X coordinates (minimum x=1, second minimum x=2...)

initial TABLE required TABLE
id ref id ref order
35 A 35 A 1 36 A 36 A 2 37 A 37 A 3 38 B 38 B 1 39 C 39 C 1 40 C 40 C 2

initial TABLE required TABLE
id ref x_coord id ref x_coord order 35 A 5 35 A 5 2 36 A 3 36 A 3 1 37 A 10 37 A 10 3 38 B 7 38 B 7 1 39 C 5 39 C 5 1 40 C 8 40 C 8 2

view of the initial and required table

7

1 Answer 1

0

apparently, it works

array_find ( array_sort (array_agg ( "x_coord" , group_by:="ref")) ,"x_coord" )+1

but the easiest way is to use the function Add autoincremental field, grouped by "ref" and sorted by "X_COORDS"

wiew of the parameters function

Not the answer you're looking for? Browse other questions tagged or ask your own question.