<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Population forecast with attribute rules. in ArcGIS Pro Questions</title>
    <link>https://community.esri.com/t5/arcgis-pro-questions/population-forecast-with-attribute-rules/m-p/1338616#M74057</link>
    <description>&lt;P&gt;Hi.&lt;/P&gt;&lt;P&gt;I'm trying to make a population forecast based on todays population multiplied with a coefficient I calculated based on previous years population.&lt;/P&gt;&lt;P&gt;Now I'm struggling to write the attribute rules. I want to calculate the values "diagonally" since the people that are 1 year old 2023 are 2 years old 2024 and so on.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I attached a snippet of what I want to accomplish as well as a filegeodatabase.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Please help me to write the attribute rule&lt;/P&gt;</description>
    <pubDate>Tue, 17 Oct 2023 14:31:40 GMT</pubDate>
    <dc:creator>PetronellaHauptmann1</dc:creator>
    <dc:date>2023-10-17T14:31:40Z</dc:date>
    <item>
      <title>Population forecast with attribute rules.</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/population-forecast-with-attribute-rules/m-p/1338616#M74057</link>
      <description>&lt;P&gt;Hi.&lt;/P&gt;&lt;P&gt;I'm trying to make a population forecast based on todays population multiplied with a coefficient I calculated based on previous years population.&lt;/P&gt;&lt;P&gt;Now I'm struggling to write the attribute rules. I want to calculate the values "diagonally" since the people that are 1 year old 2023 are 2 years old 2024 and so on.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I attached a snippet of what I want to accomplish as well as a filegeodatabase.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Please help me to write the attribute rule&lt;/P&gt;</description>
      <pubDate>Tue, 17 Oct 2023 14:31:40 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/population-forecast-with-attribute-rules/m-p/1338616#M74057</guid>
      <dc:creator>PetronellaHauptmann1</dc:creator>
      <dc:date>2023-10-17T14:31:40Z</dc:date>
    </item>
    <item>
      <title>Re: Population forecast with attribute rules.</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/population-forecast-with-attribute-rules/m-p/1339037#M74093</link>
      <description>&lt;P&gt;Hola Petronella. Siento escribir en Español pero lo del inglés se me da fatal y el traductor puede dar confusión por lo que veo cuando dices en diagonal es que quieres que el dato 1 del campo uno vaya al dato 2 del campo 2 y así sucesivamente. La verdad es que no creo que se pueda hacer por una regla de atributo ya que es programación en Arcade y eso parece que deseas que un cursor recorra la tabla de datos&amp;nbsp; y la vaya rellenado con la multiplicación y eso es más lógico con ArcPy ya que al ser programación orientada a objetos si puede recorrer la tabla y poner el resultado en donde deseas.&lt;/P&gt;&lt;P&gt;Este es un ejemplo aunque no lo he probado pero sería así porque Cursor es la parte de por así decirlo programación orientada a objetos.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;import arcpy&lt;/P&gt;&lt;P&gt;# Establecer el nombre de la tabla&lt;BR /&gt;tabla = "miTabla"&lt;/P&gt;&lt;P&gt;# Crear una lista de campos&lt;BR /&gt;campos = ["campo1", "campo2", "campo3", "campo4", "campo5"]&lt;/P&gt;&lt;P&gt;# Para cada campo en la lista de campos&lt;BR /&gt;for i in range(len(campos) - 1):&lt;BR /&gt;# Crear una lista para almacenar los valores de la fila&lt;BR /&gt;fila_valores = []&lt;/P&gt;&lt;P&gt;# Usar un cursor de búsqueda para obtener los valores del campo actual&lt;BR /&gt;with arcpy.da.SearchCursor(tabla, [campos[i]]) as cursor:&lt;BR /&gt;for fila in cursor:&lt;BR /&gt;fila_valores.append(fila[0])&lt;/P&gt;&lt;P&gt;# Multiplicar cada valor obtenido por 10&lt;BR /&gt;nuevos_valores = [valor * 10 for valor in fila_valores]&lt;/P&gt;&lt;P&gt;# Usar un cursor de actualización para cambiar los valores del siguiente campo&lt;BR /&gt;with arcpy.da.UpdateCursor(tabla, [campos[i + 1]]) as cursor:&lt;BR /&gt;count = 0&lt;BR /&gt;for fila in cursor:&lt;BR /&gt;if count &amp;lt; len(nuevos_valores): # No queremos actualizar más allá de los valores que tenemos&lt;BR /&gt;fila[0] = nuevos_valores[count]&lt;BR /&gt;cursor.updateRow(fila)&lt;BR /&gt;count += 1&lt;/P&gt;&lt;P&gt;lo hice con una hipótesis de que multiplique por 10 pero puedes hacer lo que desees y con 5 campos&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Es importante tener en cuenta que este código asume que todas las filas tienen un valor en el campo1. Si alguna fila no tiene un valor en el campo1, es posible que debas ajustar el código para manejar este caso.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Espero que esto te ayude.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 18 Oct 2023 11:12:51 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/population-forecast-with-attribute-rules/m-p/1339037#M74093</guid>
      <dc:creator>JuanManuelCruzHerrera</dc:creator>
      <dc:date>2023-10-18T11:12:51Z</dc:date>
    </item>
  </channel>
</rss>

