• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Passing a string dynamically to a ReplaceNoCase Function

Participant ,
Mar 23, 2007 Mar 23, 2007

Copy link to clipboard

Copied

I am working on being able to change some configuration settings to a page. I won't know what that settings is until a table is created. I would like to be able to concatenate the new string so it can be written into the page using RePlaceNoCase.
The 2 things I want to make into a string is application.settings.users.&form.table Not sure how or even if I can do this. If I hard code it like below it works perfectly.

TOPICS
Advanced techniques

Views

274

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Advocate , Mar 23, 2007 Mar 23, 2007
Try this:
<cfset AppInitFile = ReplaceNoCase(AppInitFile,
"LocalGrid.TableName=""##qGetThis.george##"";",
"LocalGrid.TableName=""##application.settings.users.#form.table###"";", "ALL")>

It looks like you were going a little overboard on pound signs.

Votes

Translate

Translate
Participant ,
Mar 23, 2007 Mar 23, 2007

Copy link to clipboard

Copied

I tried modifying the code.
This is what I am getting.
LocalGrid.TableName="#application.settings.users.&form.table#";
This is what I am expecting.
LocalGrid.TableName="#application.settings.users.dbtablename2#";

Here is my code.

<cffile action="read" file="C:/projects/opiax/_admin/dynpicommentmgr.cfm" variable="AppInitFile">
<cfset AppInitFile = ReplaceNoCase(AppInitFile, "LocalGrid.TableName=""##qGetThis.george##"";", "LocalGrid.TableName=""##application.settings.users.##&##form.table##"";", "ALL")>

<cffile action="write" file="C:/projects/opiax/_admin/dynpicommentmgr.cfm" output="#AppInitFile#" nameconflict="overwrite">

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advocate ,
Mar 23, 2007 Mar 23, 2007

Copy link to clipboard

Copied

LATEST
Try this:
<cfset AppInitFile = ReplaceNoCase(AppInitFile,
"LocalGrid.TableName=""##qGetThis.george##"";",
"LocalGrid.TableName=""##application.settings.users.#form.table###"";", "ALL")>

It looks like you were going a little overboard on pound signs.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources
Documentation