Hello,
I want to add the values in the RESULT field from two rows which are similar but the numbers are inverted. For example I want to add the values from the row with SUB_REGION field having 1 and SUB_REGI_1 field having 5 to the row with SUB_REIGON field having 5 and SUB_REGI_1 field having 1. These are actually calculations from commuter data between sub-regions. So I want to have the RESULT value to contain the sum of values from people commuting from 1 to 5 and from 5 to 1. Any way I can do this with a script? It seems impossible to me at the moment.
Thanks alot!
So I want to add 0.146561 with 2.072405 and write the summed up number in place of these two numbers in the Result field
No. There is a field called 'Result' right? I want to add the values in this field for row having case ID 1 5 and the row having case ID 5 1 and write this new value in the same Result field for both rows.
Then using your field calculator, change your parser to python on the left hand side double click the first field then click the plus operator then double click the second field you want to add. 5+1 = 6 Is that what your asking?
Oh no I think you did not understand the question completely. I don't want to modify the case ID field. I wanted to sum up the values in the result field for the rows with case IDs 1 5 and 5 1 and write that sum to the result field in both rows.
This seems helpful thanks.
You could use the field calculator not sure i understand what you want the end result to be.
If you want them to be 1 - 5 you would need to convert the numbers to stings so using the python parser in the field calculator you would
str(!SUB_REGI_1!)+"-"str(SUB_REIGON )
I can possibly give you an approach that may help you get started....
I occasionally have to put Origin/Destination data together for various transportation planners. The approach I take:
I export the data to a database and write an SQL query to do the sums for me. Note that the query syntax will be dependent upon the database you use... ie in SQL Server I believe the syntax for min will be least and max will be greatest.....
hope this sparks some ideas that will help.
SELECT min(Sub_Region, Sub_Regi_1) as SubRegion1, max(Sub_Region, Sub_Regi_1) as SubRegion2, sum(dataCountfield) as cnt FROM YourDataSet GROUP BY min(Sub_Region, Sub_Regi_1), max(Sub_Region, Sub_Regi_1)
Signed in members can post, follow updates, and more. New here? Register a free account.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.