On Aug 28, 2:57 pm, "Ahmed, Shakir" <shah...@sfwmd.govwrote:
I am trying to use python script to update a table by incremental value
based on struc_No but having problem to get right result on the value
field for the 3rd and 4th same number of struc_no.
I need to update the Value field only with the incremental value of 15
or so
Any help is highly appreciated.
Thanks
Shak
Input table or source table
ID struc_id Struc_No Value
1 ABC 1001 10
2 EFJ 1005 15
3 HIK 1003 10
4 ILK 1005 10
5 PIO 1001 8
6 TIN 1001 12
7 MNO 1001 11
8 POW 1003 18
Output Table
ID struc_id Struc_No Value Added value
1 ABC 1001 25 15
2 EFJ 1005 30 15
3 HIK 1003 25 15
4 ILK 1005 40 30
5 PIO 1001 38 30
6 TIN 1001 57 45
7 MNO 1001 71 60
8 POW 1003 48 30
Well you certainly won't learn anything if you don't at least try to
solve the problem.
>>file = open('Somefile', 'r').readlines()
for line in file:
.... x = line.split()
.... if not x[3] == "Value":
.... print int(x[3]) + 15
I'm sure you can take it from here. Hope it helps.
Best regards
Jeffrey van Aswegen