2 Replies Latest reply on Mar 23, 2007 10:31 AM by insuractive

    Passing a string dynamically to a ReplaceNoCase Function

    cutie369 Level 1
      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.

        • 1. Re: Passing a string dynamically to a ReplaceNoCase Function
          cutie369 Level 1
          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">
          • 2. Re: Passing a string dynamically to a ReplaceNoCase Function
            insuractive Level 3
            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.