Pass function name as parameter in SSRS expression

I have a function (GetColumnFieldName) which returns string datatype
Now I want to use this function in below SSRS expression
=Code.GetDisplay("FirstName",Parameters!SelectedCols.Value,Parameters!DisplayCols.Value)
At the above expression I want to replace "FirstName" with  function GetColumnFieldName which returns the same "FirstName".
Please suggest.

Hi Jajatibabu,
If I understand correctly, you want to use GetColumnFieldName function which returns a field name to replace the “FirstName” in the expression you post.
If in this scenario, we can directly use Code.GetColumnFieldName(parameters) to replace the “FirstName” like below:
=Code.GetDisplay(Code.GetColumnFieldName(parameters),Parameters!SelectedCols.Value,Parameters!DisplayCols.Value)
Note that we should type the correct parameters in the GetColumnFieldName function.
If there are any misunderstanding, please elaborate the issue for further investigation.
Thanks,
Katherine Xiong
If you have any feedback on our support, please click
here.
Katherine Xiong
TechNet Community Support

Similar Messages

  • Can I pass function name as a parameter to constructor?

    Hi!
    I want to create a class that extends JButton and executes some function, when released. The function for each button is different. I mean, can I write, for example:
    public class MyButton extends JButton
    public MyButton(...functionName...)
    addMouseListener(new MouseAdapter()
         public void mouseReleased(MouseEvent e)
         ...execute functionName...;
    MyButton testButton = new MyButton(printTest);
    void printTest()
    System.out.println("The button executes OK");
    (This code will not work, of cause).
    If you understood me, please answer if there is any way to pass function as a parameter ?
    Thank you in advance.

    Using reflection would work, but there is a more straightforward way. Here's what I do when I want to pass a method to be called by another object: First I declare an interface named Callback:public interface Callback
      public void run();
    }Then your class would look like this:public class MyButton extends JButton {
      private Callback doit;
      public MyButton(Callback whatToDo) {
        doit = whatToDo;
        addMouseListener(new MouseAdapter() {
          public void mouseReleased(MouseEvent e) {
            whatToDo.run();
    }and the code that creates a MyButton might look like this:Callback callMe = new Callback() {
      public void run() {
        System.exit(0);
    MyButton closeButton = new MyButton(callMe);
    closeButton.setText("Close");If you like, you can adapt this pattern to use variations of Callback that have parameters or return values.

  • Pass table name as parameter in prepared Statement

    Can I pass table name as parameter in prepared Statement
    for example
    select * from ? where name =?
    when i use setString method for passing parameters this method append single colon before and after of this parameter but table name should be send with out colon as SQL Spec.
    I have another way to make sql query in programing but i have a case where i have limitation of that thing so please tell me is it possible with prepared Statment SetXXx methods or not ?
    Thanks
    Haroon Idrees.

    haroonob wrote:
    I know ? is use for data only my question is this way to pass table name as parameterI assume you mean "how can I do it?" As I have already answered "is this the way?" with no.
    Well, I would say (ugly as it is) String concatenation, or stored procedures.

  • Passing function name into another function?

    Hi
    I have a movieclip prototype thats scales and moves any
    movieclips depending
    on the parameters passed in. I want to be able to pass in a
    function name
    that is executed when the main function has finished. The
    problem is the
    line of code that calls the main function executes the
    function name that I
    m trying to pass in as a parameter. Is there something I m
    missing?
    see my code below:
    "mcMainAnimation.moveFadeTransform(0, mcMainAnimation._y,
    -100,
    mcMainAnimation._xscale, -30, 50,moveToX());"
    MovieClip.prototype.moveFadeTransform = function(t, oldY,
    diffY, oldScale,
    newScale, tTime, funcToCall) {
    this.onEnterFrame = function() {
    t++;
    if (t<=tTime) {
    this._y = easeIn(t, oldY, diffY, tTime);
    this._xscale = easeIn(t, oldScale, newScale, tTime);
    this._yscale = easeIn(t, oldScale, newScale, tTime);
    } else {
    t = 0;
    funcToCall;
    this.onEnterFrame = null;
    moveToX = function () {
    trace("called");
    Thank in advance
    Shaun

    Hi!
    Try to modify code to:
    mcMainAnimation.moveFadeTransform(0, mcMainAnimation._y,
    -100,
    mcMainAnimation._xscale, -30, 50,moveToX);"
    ... so don't use () at end of function. That should do the
    trick.
    Also, you need to add the () to funcToCall, so that instead
    of:
    t = 0;
    funcToCall;
    this.onEnterFrame = null;
    you should have
    t = 0;
    funcToCall();
    this.onEnterFrame = null;
    /Jensen/
    "forums.macromedia.com" <[email protected]>
    wrote in message
    news:e6m428$qa0$[email protected]..
    > Hi
    >
    > I have a movieclip prototype thats scales and moves any
    movieclips
    > depending on the parameters passed in. I want to be able
    to pass in a
    > function name that is executed when the main function
    has finished. The
    > problem is the line of code that calls the main function
    executes the
    > function name that I m trying to pass in as a parameter.
    Is there
    > something I m missing?
    >
    > see my code below:
    >
    > "mcMainAnimation.moveFadeTransform(0,
    mcMainAnimation._y, -100,
    > mcMainAnimation._xscale, -30, 50,moveToX());"
    >
    > MovieClip.prototype.moveFadeTransform = function(t,
    oldY, diffY, oldScale,
    > newScale, tTime, funcToCall) {
    > this.onEnterFrame = function() {
    > t++;
    > if (t<=tTime) {
    > this._y = easeIn(t, oldY, diffY, tTime);
    > this._xscale = easeIn(t, oldScale, newScale, tTime);
    > this._yscale = easeIn(t, oldScale, newScale, tTime);
    > } else {
    > t = 0;
    > funcToCall;
    > this.onEnterFrame = null;
    > }
    > };
    > };
    >
    > moveToX = function () {
    > trace("called");
    > }
    >
    >
    > Thank in advance
    >
    > Shaun
    >

  • Passing TABLE NAME as parameter is possible or not?

    I want develop a small/simple report like this
    TABLE NAME :
    WHERE :
    ORDER BY :
    QUERY ROWS
    In the above model i want to pass all the three (TABLE NAME,WHERE and ORDER BY) as a parameter.
    My doubt, is that possible to pass TABLE NAME as a parameter? If so!
    When i enter any TABLE NAME it has to fetch me out the records of that table (Based on WHERE condition and ORDER BY).
    Is that possible to do?
    Need some help!
    Edited by: Muthukumar Seshadri on Aug 10, 2012 6:19 PM

    Yes, it is possible with lexical parameters. Look in the help for examples:
    SELECT Clause
    SELECT &P_ENAME NAME, &P_EMPNO ENO, &P_JOB ROLE  FROM EMP
    P_ENAME, P_EMPNO, and P_JOB can be used to change the columns selected at runtime.  For example, you could enter DEPTNO as the value for P_EMPNO on the Runtime Parameter Form. 
    Note that in this case, you should use aliases for your columns.  Otherwise, if you change the columns selected at runtime, the column names in the SELECT list will not match the Report Builder columns and the report will not run.
    FROM Clause
    SELECT ORDID, TOTAL FROM &ATABLE
    ATABLE can be used to change the table from which columns are selected at runtime.  For example, you could enter ORD for ATABLE at runtime. 
    If you dynamically change the table name in this way, you may also want to use lexical references for the SELECT clause (look at the previous example) in case the column names differ between tables.
    WHERE Clause
    SELECT ORDID, TOTAL FROM ORD WHERE &CUST
    ORDER BY Clause
    SELECT ORDID, SHIPDATE, ORDERDATE, TOTAL  FROM ORD ORDER BY &SORT You have to be really careful with this approach. Dynamic SQL may cause serious performance problems.
    Edited by: InoL on Aug 10, 2012 10:06 AM

  • Passing innerclass name as parameter

    Hi,
    How i can pass inner class name as parameter which is used to create object of inner class in the receiving method (class.formane(className))
    Hope somebody can help me.
    Thanks in advance.
    Prem

    Make the inner class as a parameter. An outer class object would also be required to create an inner class object.
    OuterClass outerClass=new OuterClass();
    InnerClass innerClass=outerClass.new InnerClass();

  • Passing Block Name As Parameter

    Dear Friends
    I have procedure to search for specific data, and the results will be shows on different data blocks, based on the button called the procedure, i passed the block name as parameter to the procedure, but when i want to set the values of the items in the data block, i got error, i used the following code
    copy(name_in(items_rec),block1||'.item_name')
    each time i got the following error: ORA-01722.
    can you please help me in this problem
    and thanks in advance for all friends
    Mohammad

    Hi,
    Try
    copy(name_in(items_rec),name_in(block1||'.item_name'))I assume, block1 is the variable which you are passing as a parameter to the procedure.
    Regards,
    Arun

  • Passing proc name as parameter

    I have a procedure emp_proc,
    Is there a way to write a working procedure of following type:
    procedure mgr_proc(get_proc_name varchar2) is
    begin
    get_proc_name; --(this won't work,and this is where i need help)
    end;
    I need to be able to pass emp_proc as a parameter to mgr_proc and get
    it executed inside mgr_proc.
    thanks

    While this is often (if not generally) a bad idea, you can use dynamic SQL here, i.e.
    BEGIN
      EXECUTE IMMEDIATE 'BEGIN ' || get_proc_name || '(<<parameter list>>) END;';
    END;Justin

  • Dynamic SQL : passing table name as parameter

    Hi
    I have a SQL query (a store procedure )  that i want to convert to PLSQL
    This is a part of my SQL query that i am trying to to find a solution for it, because i cant convert it to oracle :
    DECLARE lookupTableRow CURSOR FOR
      SELECT TableName FROM SYS_LookUpTable
      OPEN lookupTableRow
      FETCH NEXT FROM lookupTableRow INTO @tableName
      WHILE @@FETCH_STATUS=0
      BEGIN
      SET @sql='SELECT * FROM '+@tableName
    EXECUTE sp_executesql @sql
      IF @counter=0
      BEGIN
      INSERT INTO T_TABLE_MAPPING VALUES('P_MAIN_METADATA', 'Table', @tableName)
      END
      ELSE
      BEGIN
      INSERT INTO T_TABLE_MAPPING VALUES('P_MAIN_METADATA', 'Table'+CONVERT(NVARCHAR(10),@counter), @tableName)
      END
      SET @counter=@counter+1
      FETCH NEXT FROM lookupTableRow INTO @tableName
      END
      CLOSE lookupTableRow
      DEALLOCATE lookupTableRow
    As i understand i can't use ORACLE dynamic sql (execute immediate) when the table name is a parameter
    Furthermore when i execute this dynamic query in my SQL store procedure each SELECT statement return me as a result the relevant table rows , those result are different in each loop .
    So i cant do this too with ORACLE dynamic sql .
    Please advice for any solution
    * how can i use dynamic sql with table name as parameter ?
    * how can i use a "dynamic" cursor, in order to be able to display the dynamic results ?
    Thanks for the advice

    Hi,
    b003cf5e-e55d-4ff1-bdd2-f088a662d9f7 wrote:
    Hi
    I have a SQL query (a store procedure )  that i want to convert to PLSQL
    This is a part of my SQL query that i am trying to to find a solution for it, because i cant convert it to oracle :
    DECLARE lookupTableRow CURSOR FOR
      SELECT TableName FROM SYS_LookUpTable
      OPEN lookupTableRow
      FETCH NEXT FROM lookupTableRow INTO @tableName
      WHILE @@FETCH_STATUS=0
      BEGIN
      SET @sql='SELECT * FROM '+@tableName
    EXECUTE sp_executesql @sql
      IF @counter=0
      BEGIN
      INSERT INTO T_TABLE_MAPPING VALUES('P_MAIN_METADATA', 'Table', @tableName)
      END
      ELSE
      BEGIN
      INSERT INTO T_TABLE_MAPPING VALUES('P_MAIN_METADATA', 'Table'+CONVERT(NVARCHAR(10),@counter), @tableName)
      END
      SET @counter=@counter+1
      FETCH NEXT FROM lookupTableRow INTO @tableName
      END
      CLOSE lookupTableRow
      DEALLOCATE lookupTableRow
    As i understand i can't use ORACLE dynamic sql (execute immediate) when the table name is a parameter
    Furthermore when i execute this dynamic query in my SQL store procedure each SELECT statement return me as a result the relevant table rows , those result are different in each loop .
    So i cant do this too with ORACLE dynamic sql .
    Please advice for any solution
    * how can i use dynamic sql with table name as parameter ?
    * how can i use a "dynamic" cursor, in order to be able to display the dynamic results ?
    Thanks for the advice
    I have a SQL query (a store procedure )  that i want to convert to PLSQL
    I doesn't help when you use one term to mean another thing.
    SQL is a language used in both Oracle and other products, such as Microsoft's SQL Server. I don't know much about SQL Server, but Oracle (at least) doesn't support stored procedures in SQL itself; they have to be coded in some other language, such as PL/SQL.  
    As i understand i can't use ORACLE dynamic sql (execute immediate) when the table name is a parameter
    If the table name is a parameter (or only known at run-time for any reason), that's exactly the kind of situation where you MUST use dynamic SQL.
    The number of columns that a query produces (and their datatypes) is fixed when you compile a query, whether that query is dynamic or not.  If you have multiple queries, that produce result sets with different numbers of columns, then you can't combine them into a single query.  The best you can do with one query is to add NULL columns to some of the queries so they all produce the same number of columns.
    If you're just displaying the results, there might not be any reason to combine separate result sets.  Just display one result set after another.
    Whenever you have a question, post a little sample data (CREATE TABLE and INSERT statements, relevant columns only) for all the tables involved, and the results you want from that data.
    Explain, using specific examples, how you get those results from that data.
    Always say what version of Oracle you're using (e.g. 11.2.0.2.0).
    See the forum FAQ: https://forums.oracle.com/message/9362002

  • Not able to pass table name as parameter in function

    Hi,
    i am not able to pass tablename as parameter. I am using below function.
    function count_test(tabname varchar2) return number is
    l_count number;
    begin
    select count(*) INTO l_count FROM tabname;
    RETURN l_count;
    END;

    You can't do it with static SQL.
    The only way is to do it with dynamic SQL:
    EXECUTE IMMEDIATE 'select count(*) FROM '|| tabname INTO l_count;
    Regards.
    Al
    Edited by: Alberto Faenza on May 10, 2012 1:44 AM
    Mispelling

  • Is it possible to pass table name as parameter to function calls?

    Let's say I would like to retrieve data from table BSAD, BSID, BSIS, BSAS with the exact same WHERE conditions.
    I.E.
          SELECT SINGLE * FROM bsis
               WHERE bukrs = zbukrs
                 AND belnr = zbelnr
                 AND gjahr = zgjahr
                 AND buzei = bseg-buzei.
          SELECT SINGLE * FROM bsas
               WHERE bukrs = zbukrs
                 AND belnr = zbelnr
                 AND gjahr = zgjahr
                 AND buzei = bseg-buzei.
    Is there a way that I could put them into a function and do something like?
    perform select_table_bsas using 'bsas'.
    perform select_table_bsis using 'bsis'.
    and I should get SELECT * FROM passed from the function calls.
    Thanks.

    Hello,
    You can try something like this
    DATA : LV_DBTAB1 LIKE DD02L-TABNAME.
    DATA : DREF TYPE REF TO DATA.
    FIELD-SYMBOLS: <ITAB> TYPE ANY TABLE. " used to store dynamic tables
    LV_DBTAB1 = 'MARA'. " in caps
      CREATE DATA DREF TYPE STANDARD TABLE OF (LV_DBTAB1)
                                WITH NON-UNIQUE DEFAULT KEY.
      ASSIGN DREF->* TO <ITAB> .
    * chooses only english values
      SELECT * FROM (LV_DBTAB1) INTO TABLE <ITAB> WHERE SPRAS = 'E'.
    here, even the internal table is dynamic, but that can be static if you know the structure for sure

  • Help passing table name as parameter to a procedure

    Hello,
    i'm trying to write a procedure that takes a table name as input and uses a cursor to select a column,count(1) from the passed table to the cursor. The procedure i've come up with is as follows,
    CREATE OR REPLACE
    PROCEDURE excur(
        p_tbl user_tables.table_name%type )
    AS
      type rc is ref cursor;
      c rc;
      res BOOLEAN;
    BEGIN
      open c for 'SELECT columnA,COUNT(1) FROM'|| p_tbl||';';
      close c;
    END excur;When i try to execute it, an error pops up informing that a table cannot be used in this context. As in i cannot pass a table name as an argument to a procedure. Kindly guide as to how to solve this situation.

    vishm8 wrote:
    Hello,
    i'm trying to write a procedure that takes a table name as input and uses a cursor to select a column,count(1) from the passed table to the cursor. The procedure i've come up with is as follows,
    CREATE OR REPLACE
    PROCEDURE excur(
    p_tbl user_tables.table_name%type )
    AS
    type rc is ref cursor;
    c rc;
    res BOOLEAN;
    BEGIN
    open c for 'SELECT columnA,COUNT(1) FROM'|| p_tbl||';';
    close c;
    END excur;When i try to execute it, an error pops up informing that a table cannot be used in this context. As in i cannot pass a table name as an argument to a procedure. Kindly guide as to how to solve this situation.Generally speaking, Dynamic code is a bad idea for a staggering number of reasons.
    That aside, what do you want to return? You're selecting a column and applying an aggregate function (count) but you're not grouping, that doesn't usually work out too well.
    TUBBY_TUBBZ?select owner, count(*) from all_objects;
    select owner, count(*) from all_objects
    ERROR at line 1:
    ORA-00937: not a single-group group functionWhy do you perceive the need to be able to take in ANY table name, can't you design an application where table names are known at compile time and not run time?

  • How to pass file name as parameter into url: or fo:external-graphic src

    Hello gurus,
    In my rtf I want to dynamically get the name of the image file and display the image in the report. If use hard coded image file name it works but if I try to get the name into a variable and pass that variable it is not working.
    Basically my client is having different logos for each operating unit. in the OA_MEDIA directory there are separate logos for each OU. during run time based on OU name we need to display the corresponding image. If I can get this entire path($OA_MEDIA/logo.jpg') in XML field<?CF_OU_LOGO?> then I'm able to print the logo using url:{CF_OU_LOGO}
    But I'm using seeded data source and I cant modify the data source, I need to handle this in RTF only. I could able to get the file name into a variable but not sure how to pass to url.
    could some one help me on this. I tried the following options
    <fo:external-graphic src="url($ln)" />
    url:{$ln} in web etc...
    here 'ln' is the variable which holds '$OA_MEDIA/logo.jpg'. ln is defined as <xsl:variable name="ln" select=".//CF_OPERATING_UNIT" />
    later I set the values as <?xdoxslt:set_variable($_XDOCTX, 'ln',translate( concat('${OA_MEDIA}/','Logo',.//CF_OPERATING_UNIT,'.jpg'),' ',''))?><?xdoxslt:get_variable($_XDOCTX, 'ln')?>
    thanks,
    Vijay

    Vijay
    What version of EBS is the customer running? I read somewhere that in R12 all of the concurrent parameters are passed to the XMLP template. I have not tried this but if true. You could create a conc program parameter that would hold the location of the image. You could either have the user pick the image or maybe derive it from the other parameter choices.
    Lets assume the token name is DLOGO you can reference that in your template.
    <?param:DLOGO?>
    this needs to be at the top of the template. Then where you need to embed the image just reference the value using
    $DLOGO
    You can embed this in the external graphic field
    As I mentioned I have not tested it yet, hopefully its there, if not there are ways around it. Try it first.
    Tim

  • Passing Table name as parameter to proc.

    Hi,
    I need to know how to pass a table name to a oracle procedure.
    In that procedure I will put that table name in a variable and then I will make operations on that table like DELETE, UPDATE and INSERT.
    Kinldy give me the solution for the above problem as soon as possible..
    Thanks & regards,
    Kiran

    You shouldn't do it, but if you do, you can use something like this:
    Anton
    create or replace type my_parm as object
      ( name varchar2(30)
      , val  anydata
    create or replace type my_parms as table of my_parm
    create table t1( c1 number, c2 varchar2(10), c3 date )
    create or replace procedure doital( p_action in varchar2, p_tab in varchar2, parms in my_parms )
    is
      p_stmt1 varchar2(32000);
      p_stmt2 varchar2(32000);
      ind pls_integer;
      curs integer;
      dummy integer;
      t_a anytype;
      t_v varchar2(32000);
      t_n number;
      t_d date;
    begin
      curs := dbms_sql.open_cursor;
      if upper( p_action ) = 'I'
      then
        ind := parms.first;
        loop
          exit when ind is null;
          p_stmt1 := p_stmt1 || ', ' || parms( ind ).name;
          p_stmt2 := p_stmt2 || ', :b' || to_char( ind );
          ind := parms.next( ind );
        end loop;
        p_stmt1 := 'insert into ' || p_tab || ' (' || substr( p_stmt1, 2 ) || ' ) values (' || substr( p_stmt2, 2 ) || ' )';
        dbms_sql.parse( curs, p_stmt1, dbms_sql.native );
        ind := parms.first;
        loop
          exit when ind is null;
          case parms( ind ).val.GetType( t_a )
            when dbms_types.typecode_varchar2
            then
              dummy := parms( ind ).val.GetVarchar2( t_v );
              dbms_sql.bind_variable( curs, ':b' || to_char( ind ), t_v );
            when dbms_types.typecode_number
            then
              dummy := parms( ind ).val.GetNumber( t_n );
              dbms_sql.bind_variable( curs, ':b' || to_char( ind ), t_n );
            when dbms_types.typecode_date
            then
              dummy := parms( ind ).val.GetDate( t_d );
              dbms_sql.bind_variable( curs, ':b' || to_char( ind ), t_d );
          end case;
          ind := parms.next( ind );
        end loop;
      end if;
      dummy := dbms_sql.execute( curs );
      dbms_sql.close_cursor( curs );
    end;
    begin
      doital( 'I', 't1', my_parms( my_parm( 'c2', anydata.ConvertVarchar2( 'testje' ) )
                                 , my_parm( 'c1', anydata.ConvertNumber( 3 ) )
                                 , my_parm( 'c3', anydata.ConvertDate( sysdate ) )
      doital( 'I', 't1', my_parms( my_parm( 'c1', anydata.ConvertNumber( 77 ) )
                                 , my_parm( 'c2', anydata.ConvertVarchar2( 'goedzo' ) )
                                 , my_parm( 'c3', anydata.ConvertDate( sysdate - 5 ) )
    end;
    /

  • How to pass Table name as parameter

    For example, you have several tables (TableA, TableB, TableC...TableN) that have the same structure.
    Ex.
    CREATE TABLE TableA(
    id VARCHAR(5),
    name VARCHAR(20)
    CREATE TABLE TableB(
    id VARCHAR(5),
    name VARCHAR(20)
    And you want to create a stored procedure in Oracle that can be used for all of the tables (TableA, TableB, ...)
    Ex. SELECT * FROM <tablename>
    WHERE ID > 1;
    How do you write the prepareCall and Callable Statement for that?
    Thanks in advance.

    You can't, not directly.
    You have two choices:
    -Write the SQL in java, then you can use string concatenation.
    -Use 'dynamic sql' in Oracle. There is a standard package that will take dynamic sql and run it.

Maybe you are looking for

  • Could not place picture, scratch disks are full

    Hello, after fresh installation of Windows 7 ultimate on a PC (Intel Core-i5, GA-H97, 8GB RAM, 120 SSD for system, 1TB for data), and Photoshop CC 2014, we have a problem: When  trying to add a picture to a new Photoshop document we get the following

  • HT2493 How to change preview image of a file and NOT the icon ?

    Hello dear Mac users How to change preview image of a file and NOT the icon ? I know how to change the icon of a file, but I wish to know how to change the preview of any file. For example: my file is "mysong.aif", I changed the icon to be "mylogo.pn

  • How can I order a spanish wireless keyboard?

    I want to order the wireless keyboard for my Ipad 2 but can't find the option to choose a spanish keyboard, does anybody knows the direct link or how can I do so? Thank you!

  • Apex and fusion charts

    Hi, I am using Apex with fusion charts and can easly create a one series Charts, how can I create 2 or Multiple series Charts? regards. MDK.

  • Hyperlink Default Color

    I don't know if it's just me but the default color for my iWeb hyperlinks is brown. Is there any way I can change the default color to blue or another? Of course, I can change links individually but I'd rather not have brown as the default. Thanks.