[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

replace two variable in file content

Posted on 2011-04-21
2
Medium Priority
?
191 Views
Last Modified: 2012-06-27
Hello,  I have a file creation script that works great when i only have to replace one variable,  however, i need to replace two variables and can't get the script to work.  I know that what i have now replaces CC with XX.  I have also tried several other tires.  

What i really need is in the file with the variables to have the url="CC" be replaced with the qlist.cid and the xx be replace with  qlist.scndtgry_ID.

if i remove either one of the cc or xx from the replace the one that is left gets the correct nubmer.  i just really need both.  

hopefully this makes sense.

thank you.


here is the code for the creation,
<cfset CC = qList.CID>
 <cfset XX = qList.scndctgry_ID>
<cfset ses_fileContents = replace(ses_fileContents_original, "CC" , "XX", #qList.CID# & #qList.scndctgry_ID#)> 

here is the file with the variables

<cfset url.category = "CC">
<cfset url.secondary = "XX">
<cfinclude template="SubMain.cfm">

Open in new window

0
Comment
Question by:TigerladyBarb
2 Comments
 
LVL 19

Accepted Solution

by:
Bhavesh Shah earned 2000 total points
ID: 35440784
Hi,

try this

<cfset CC = qList.CID>
 <cfset XX = qList.scndctgry_ID>
<cfset ses_fileContents = replace(replace(ses_fileContents_original, "CC" , #qList.CID#) ,"XX",#qList.scndctgry_ID#)>
0
 

Author Closing Comment

by:TigerladyBarb
ID: 35440869
Oh my gosh i didn't even think of the double replace.  I tried so many other variations.  finally i can move on.
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The technique is by far very Simple! How we can export the ColdFusion query results to DOC file?  Well before writing this I researched a lot in Internet but did not found a good Answer anyways!  So i thought now i should share my small snippet w…
CFGRID Custom Functionality Series -  Part 1 Hi Guys, I was once asked how it is possible to to add a hyperlink in the cfgrid and open the window to show the data. Now this is quite simple, I have to use the EXT JS library for this and I achiev…
Integration Management Part 2
Screencast - Getting to Know the Pipeline

872 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question