Skip to main content
Inspiring
June 7, 2006
Answered

Swapping field values

  • June 7, 2006
  • 2 replies
  • 299 views
I have a location value coming from a database that has the value 'Main/Offshore' but I want to be able to swap the word 'Main' for 'UK'. I have put in the code:

<cfif #mid(location,1,5)# IS "Main/" >UK
<cfelse>#location#
</cfif>

but this swaps the whole value and shows only UK. I want it to show UK/Offshore. Is there a way I can do this?
This topic has been closed for replies.
Correct answer paross1
<cfif #mid(location,1,5)# IS "Main/" >#Replace(location, "Main", "UK")#
<cfelse>#location#
</cfif>

Phil

2 replies

csber3Author
Inspiring
June 7, 2006
doh! that worked. never thought it would be that simple.

Thanks!
paross1Correct answer
Participating Frequently
June 7, 2006
<cfif #mid(location,1,5)# IS "Main/" >#Replace(location, "Main", "UK")#
<cfelse>#location#
</cfif>

Phil