Skip to main content
Solved

generate numbers between two values


zizou84
Contributor
Forum|alt.badge.img+1

Hello,

I need to generate data by year (whereas I only have periods)

To do this, I'll need to generate numbers between two values (typically years) to make a join with my existing data.

I thought of using counter but I need input data, I just want to generate all the numbers between two values (for ex 1791 to 2024)

thanks in advance for your help

 

Best answer by nielsgerrits

I think you want a feature for each year between 1791 and 2024? One way to do this is:

  • Expected input is one feature with attributes FromYear = 1791 and ToYear = 2024.
  • Calculate the difference between the 2 years.
    • AttributeCreator
      • AttributeName: Years
      • AttributeValue: @Evaluate(@Value(ToYear)-@Value(FromYear))
  • Create a feature for each year.
    • Cloner
      • Number of Copies: Years
      • Copy Number: Year Number
  • Create a Year attribute for each feature
    • AttributeCreator
      • AttributeName: Year
      • AttributeValue: @Evaluate(@Value(FromYear)+@Value(YearNumber))
View original
Did this help you find an answer to your question?

3 replies

nielsgerrits
VIP
Forum|alt.badge.img+54
  • Best Answer
  • July 24, 2024

I think you want a feature for each year between 1791 and 2024? One way to do this is:

  • Expected input is one feature with attributes FromYear = 1791 and ToYear = 2024.
  • Calculate the difference between the 2 years.
    • AttributeCreator
      • AttributeName: Years
      • AttributeValue: @Evaluate(@Value(ToYear)-@Value(FromYear))
  • Create a feature for each year.
    • Cloner
      • Number of Copies: Years
      • Copy Number: Year Number
  • Create a Year attribute for each feature
    • AttributeCreator
      • AttributeName: Year
      • AttributeValue: @Evaluate(@Value(FromYear)+@Value(YearNumber))

zizou84
Contributor
Forum|alt.badge.img+1
  • Author
  • Contributor
  • July 24, 2024

Thank you very much, I will try your solution !


zizou84
Contributor
Forum|alt.badge.img+1
  • Author
  • Contributor
  • July 24, 2024

Works perfectly !

 

Thanks a lot for the help!


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings