Question

Generate numbers in pairs

  • 29 June 2020
  • 7 replies
  • 15 views

Hello,

how to generate numbers in pairs from 2 to 80 and from 3 to 77.

ex: 2, 4, 6, 8,.....80

3, 5, 7, 9,.....77

Nr. 1Nr. 2238077

7 replies

Userlevel 1
Badge +10

Why would 80 be paired with 77?

Userlevel 5
Badge +25
You could use a Counter and then use an AttributeManager to multiply the _count value by 2 to get the first sequence, add 1 to that to get the second sequence.

 

But then the last number of the second sequence should be 81, not 77, so like @ebygomm said, why that matchup?

Can be even numbers from 2 to 12 and odd numbers from 3 to 23. (i.e. 6 numbers appears in column Nr. 1 and 11 numbers in column Nr. 2) the table posted is only for example.

Badge +1

Can be even numbers from 2 to 12 and odd numbers from 3 to 23. (i.e. 6 numbers appears in column Nr. 1 and 11 numbers in column Nr. 2) the table posted is only for example.

But, how do you know what numbers you want to pair? Is it just the last one that's out of order? So in the 2-12 and 3-23 one, do you want:

2345678910111223

 

Or what pairing do you want? If you know the formula, i.e. the relation between the lower number and the higher one, then @redgeographics is on the money. Otherwise, if you know each numbers buddy-number (i.e. the odd one), using an AttributeValueMapper might be useful. Can you clarify what the relation is between the two sets of numbers?

I've simplified the problem a little bit, and I have the following data:

NAMEA_MINA_MAXB_MINB_MAX

 

 

 

X212311

 

 

 

Y466187

 

 

 

Z1458745

 

 

 

 

 

 

 

 

 

 

 

 

Where A column contain only odd numbers and B contain only even numbers

 

Where A_MIN it represents the lowest even number and A_MAX represents the highest even number.

same with B_MIN and B_MAX.

I'm thinking about two types of results:

1.

NAMEA_MINA_MAXA_COUNTB_MINB_MAXB_COUNTX2126373Y41041116Z142047155

 

Or:

2.

NAMEABX23X45X67X81X103X125Y47Y69Y811Y107Z149Z1611Z1813Z2015
Badge +1

I've simplified the problem a little bit, and I have the following data:

NAMEA_MINA_MAXB_MINB_MAX

 

 

 

X212311

 

 

 

Y466187

 

 

 

Z1458745

 

 

 

 

 

 

 

 

 

 

 

 

Where A column contain only odd numbers and B contain only even numbers

 

Where A_MIN it represents the lowest even number and A_MAX represents the highest even number.

same with B_MIN and B_MAX.

I'm thinking about two types of results:

1.

NAMEA_MINA_MAXA_COUNTB_MINB_MAXB_COUNTX2126373Y41041116Z142047155

 

Or:

2.

NAMEABX23X45X67X81X103X125Y47Y69Y811Y107Z149Z1611Z1813Z2015

Excellent! So, for result 1) you can rely on this formula:

Number_diff = (Max-Min)/2 + 1(you'll need to add 1, since you're also including the upper bound). I.e. (A_MIN - A_MAX)/2 +1 = A_COUNT -> (12-2)/2 = 5, 5+1 = 6 = A_COUNT.

For 2) I'll try to get a small example workspace for you. However, is it correct that f.ex. the 4th row (X 8 1) has Name = X? Seeing as we've "run out" of B-values for feature X. I'll trust that your example is right though, and proceed as such.

Badge +1

Excellent! So, for result 1) you can rely on this formula:

Number_diff = (Max-Min)/2 + 1(you'll need to add 1, since you're also including the upper bound). I.e. (A_MIN - A_MAX)/2 +1 = A_COUNT -> (12-2)/2 = 5, 5+1 = 6 = A_COUNT.

For 2) I'll try to get a small example workspace for you. However, is it correct that f.ex. the 4th row (X 8 1) has Name = X? Seeing as we've "run out" of B-values for feature X. I'll trust that your example is right though, and proceed as such.

Self-reply: See if this is useful @sorindurutable_pair_builder.fmw - I've built it in 2020.0, hope that's good for you.table_pair_builder.fmw

Reply