Skip to Content
0
Former Member
Jan 04, 2008 at 11:40 PM

Use of Replace

27 Views

Post Author: LaVerne

CA Forum: Formula

I'm struggling with a conversion formula.

Background: If the account is a revenue account and the cost center begins with "6", then I need to convert the "6" to "3"; if the cost center begins with "7" then I need to convert the "7" to a "4".

Ex. 6010.401R should read 3010.401R

7077.401R should read 4077.401R

if Right ({DS_ACCOUNT_NODE.ACCOUNT},1)="R" and Left ({DS_ACCOUNT_NODE.COST_CENTER},1)="6" then Replace ({DS_ACCOUNT_NODE.COST_CENTER},"6","3",1) else

if Right ({DS_ACCOUNT_NODE.ACCOUNT},1)="R" and Left ({DS_ACCOUNT_NODE.COST_CENTER},1)="7" then Replace ({DS_ACCOUNT_NODE.COST_CENTER},"7","4",1) else

{DS_ACCOUNT_NODE.COST_CENTER} The above formula appears to work for the 6 to 3 conversion however the second step converts all 7s in the cost center to 4 i.e.

7077.401R is converting to 4044.401R

Feedback is greatly appreciated!!