Remove last character from a field

,

I am going back to a BAQ in E9 and need to remove the last Character from the PartBin.LotNum field if it is a C, any ideas how i can do it?

A calculated field with the formula below should do the trick:

case when right(PartBin.LotNum, 1)='C' then left(PartBin.LotNum, len(PartBin.LotNum)-1) else PartBin.LotNum end

Just realized the above will fail if lot is empty so try this one:

case when right(PartBin.LotNum, 1)='C' then left(PartBin.LotNum, (case when len(PartBin.LotNum)=0 then 0 else len(PartBin.LotNum)-1 end)) else PartBin.LotNum end

Also, if your lot can be null then you have to take that into account as well.

1 Like