3 Replies Latest reply on Mar 5, 2008 8:42 AM by Günter Schenk

    how to replace part of column name with dynamic value

      I have the following construction in an update transaction:

      $upd_blg_user_usr->addColumn("report_1_user", "NUMERIC_TYPE", "VALUE", "{rsCatReport.id_report}");

      The dynamic value, {rsCatReport.id_report}, gets a url variable.

      I want this variable to replace the "1" in the column name "report_1_user". Something like this:

      $upd_blg_user_usr->addColumn("report_{rsCatReport.id_report}_user", "NUMERIC_TYPE", "VALUE", "{rsCatReport.id_report}");

      That construction, however, does not work. Prevents the page from loading. I've tried different constructions but have not hit one one that works.

      First, I'm not sure anything will work and second, if some different construction will work, I don't know what it is.

      Can anyone answer these questions. Thanks in advance for your help.
        • 1. Re: how to replace part of column name with dynamic value
          Günter Schenk Level 4
          Hi alterity,

          wow, that´s pretty experimental :-)

          -----
          Prevents the page from loading.
          -----

          that´s IMO a clear sign of having a PHP syntax error, assumingly in that $upd_blg_user_usr->addColumn - line

          However, you might to try embedding that URL variable directly in here, like this:

          $upd_blg_user_usr->addColumn("report_ ".$_GET['variable_name']."_user", "NUMERIC_TYPE", "VALUE", "{rsCatReport.id_report}");

          Technically this should work, does it ?

          Cheers,
          Günter Schenk
          Adobe Community Expert, Dreamweaver
          • 2. Re: how to replace part of column name with dynamic value
            Level 1
            What? Are you some kind of genius?

            Yes that works perfectly. Thanks as always!

            Here's the rationale. The same basic form appears on many different pages. The only difference among the forms is the outcome of submitting the form. The form on different pages takes you to a different download page and a database column is marked to signify that the user downloaded that form. For instance:

            report_1_usr
            report_2_usr
            report_3_usr

            And so forth...

            Up to now each form has had to include the url variable so the submit would take the user to the right download page and it has had to include a unique reference to the correct database column.

            Now I can echo or insert that url variable all over the place, including the reference to the column name in the transaction, so I can use a single instance of the form and include it on all pages.

            Thanks for helping me figure out the last step.
            • 3. Re: how to replace part of column name with dynamic value
              Günter Schenk Level 4
              Hi alterity,

              thanks very much for explaining what you have in mind with this approach -- wow, that´s abolutely smart, and we all owe you a kudos for sharing this with us and hence demonstrating that ADDT can help folks do wicked stuff beyond its wizards.

              That´s the stuff I love :-)

              Cheers,
              Günter Schenk
              Adobe Community Expert, Dreamweaver