7 Replies Latest reply: Sep 1, 2016 7:40 PM by Sunny Talwar RSS

    Variable Text in Fieldname

    Joey Lutes

      I am attempting to insert variable text directly into a fieldname within an expression.

       

      Fieldname Examples:

      [KPI AltAvg Parameter]

      [KPI AltMax Parameter]

      [KPI Avg Parameter]

      [KPI Max Parameter]


      I have created an inline table:

      Load *INLINE [

           Parameter

           AltAvg

           AltMax

           Avg

           Max ];


      I've also created a variable called $vParameter that a user can select/set via a selection box.


      What I'd like to do is create a measure that looks something like this:

      sum('KPI ' & '$(vParameter)' & ' Parameter')


      Does this have any chance of working?

      Thanks in advance!


        • Re: Variable Text in Fieldname
          Sunny Talwar

          May be try this:

           

          Sum($(='[KPI ' & vParameter & ' Parameter]'))


          Sum($(='[KPI ' & Parameter & ' Parameter]'))

            • Re: Variable Text in Fieldname
              Joey Lutes

              '[KPI ' & $(vParameter1)& ' ' & 'Parameter]'

              in a KPI box does indeed create the correct fieldname  = [KPI AltAvg Parameter]

               

              HOWEVER, if I wrap that statement in sum() it breaks.

               

              I have tried creating a Let vParamString = '[KPI ' & $(vParameter1)& ' ' & 'Parameter]' in the loadscript and also in the variable editor (independently).

              Unfortunately, the resulting variables don't populate the values and the result of it is the string entered, not the intended variable-created name.

               

              I've also learned that in creating a select box with the Fieldname in it - when I create the associated variable, I simply enter the fieldname in the description.  If I attempt to use GetFieldSelections(Fieldname) it fails (with or without preceding =).  Leaving just the fieldname does populate the variable accordingly when it is selected, however I'm still unable to get it to work properly

               

              I've scoured the net and apparently no one else wants to do this

              Other ideas??

              Thanks!