Select to view content in your preferred language

how to remove last 3 commas data

603
3
05-19-2023 06:41 AM
Status: Open
KarraRAJENDAR
Emerging Contributor
Field_Name
a,b,c
w,f,b,j
g,y,x,o
I,o
p,p,r,c,g,k
p,p,r,c

 

in above table i want remove data after 2 comma. can any pls suggest.

3 Comments
KenBuja

You can do this in Arcade

 

var arr = Split($feature.Field_Name, ',')
if (Count(arr) < 3) return $feature.Field_Name;
return Concatenate([arr[0], arr[1], arr[2]], ',');

 

KarraRAJENDAR

@KenBuja can u please give for calculation in arcmap

KenBuja

You should mention what you're working in when posting a question.

This Python script will do what you want

def Calc(field):
  arr = field.split(",")
  if (len(arr) < 3):
    return field 
  else:
    return ",".join(arr)