Using a Variable to select a function

Hi there.
I am looking to use a variable that is set when a user clicks
a button to then use as the variable name to call a function. The
actual functions work, but when using a variable as the function
name it doesn't call the function. Here's my code so far, could
anyone help with what I may be doing wrong (please see code snippet
attached).
Thanks a lot
Tony Mead

Thanks for the reply Dave. I wanted to use a variable because
when any of the 4 buttons are clicked they have to
1. Run the function determined by the closeActive variable
(closing the open panel - could be 1 of 4)
2. open and run a particular panel
Probably best explaind by looking at what I have done so far
(home & about us only at the moment):
http://www.soapbox-creative.com/development/08/index.html
Basically I needed the flash movie to 'know' what panel is
currently opn and when another button is clicked it can just run
the close function and close the panel that is open.
Thanks again
Tony

Similar Messages

  • Using a variable in a js function argument

    Folks,
    This is very basic, but I still cannot get it...
    I have this js function in an ASP page:function MM_changeProp(objId,x,theProp,theValue) { //v9.0
      var obj = null; with (document){ if (getElementById)
      obj = getElementById(objId); }
      if (obj){
        if (theValue == true || theValue == false)
          eval("obj.style."+theProp+"="+theValue);
        else eval("obj.style."+theProp+"='"+theValue+"'");
    }i don't understand the function, as it was put in automatically by dreamweaver. right now, i am using this onclick event of an image:<div id="apDiv19" onclick="MM_changeProp('apDiv7','','backgroundColor','#FFFF00','DIV')"></div>the #FFFF00 is the color YELLOW. it is being passed to the theValue argument of the js. what i simply want to do is establish a global variable that will house a color string (like #FFFF00), and then use it in the function argument everytime i need the function. something like this:<div id="apDiv19" onclick="MM_changeProp('apDiv7','','backgroundColor',VARIABLE,'DIV')">i do not know how to do two things:
    1) initialize and assign the variable a value, and where to establish it (inside the script tags? in the head? in the body?)
    2) how to use the variable as an argument in the function
    any help greatly appreciated for this novice. thanks!

    ajetrumpet wrote:
    Folks,
    This is very basic, but I still cannot get it...
    I have this js function in an ASP page:This forum is not about ASP nor JavaScript. Please use Google to find an appropriate JavaScript forum.

  • Use a variable name within a function?

    here's my function....
    myInterval = setInterval (TTMO,15);
    function TTMO () {
    InstanceNameOfMovieClip._x -= (InstanceNameOfMovieClip._x -
    _xmouse)/10;
    InstanceNameOfMovieClip._y -= (InstanceNameOfMovieClip._y -
    _ymouse)/10-2;
    instead of using the "InstanceNameOfMovieClip" can i use a
    variable name? i've tried, but it doesn't work. i also tried using
    the correct hierarchy too, such as this._parent.VariableName
    too.

    you need to concat the linkage to the movieclip using your
    string variable like this
    var mcName_str = "bigBox_mc";
    this[mcName_str]._x = 20;
    you can use this method for looping through incrementally
    named objects
    for(var i:Number=0;i<10;i++)
    this["mc"+i]._x = 20;
    hope that helped

  • Odd Behaviour using User Variables to select members in Planning form

    I have a form to enter budget adjustments and another form to review the effects of those adjustments at a parent Entity level.
    For each area of the business there are obviously different adjustment and parent levels required in the form.
    In summary I can drive a form from a User Variable using the functions (Children, IChildren, ILvl0Descendants, Descendants and IDescendants) but trying to use other options results in unexpected behaviour.
    For example with the following structure:
    Entity
    -Total Cost Centre
    --Group A
    ---SubGroupA1
    ---SubGroupA2
    ---SubGroupA3
    ---GroupA-Adj
    ----GroupA-AdjX
    -----AdjEntityA1
    -----AdjEntityA2
    --Group B
    ---SubGroupB1
    ---SubGroupB2
    ---SubGroupB3
    ---GroupB-Adj
    ----GroupB-AdjX
    -----AdjEntityB1
    -----AdjEntityB2
    For the adjustment entry form the users would want to see AdjEntityA1 and AdjEntityA2 if they are in business group A.
    For the review form they would like to see Group A and its children.
    I am trying to avoid writing multiple forms for each business user (largely because the number of groups can vary dramatically). I can't really use generations to drive the selections as whilst the business has effectively levelled the hierarchy business units can be working at different levels of this hierarchy.
    I want to offer a couple of options to the business. One will be to define a form that pulls all of the relevant entities into the form and relies on security to restrict the values displayed to the user. The second option would be to utilise User Variables to drive selections. It is the second option I am struggling with.
    If we consider a user working in Group A, I think I can see a formulaic way to select the various combinations of Entities if I set the user variable to be GroupA-Adj.
    I can define a data form that sets Entity to the L0Descendants of say GroupA-Adj and this is fine.
    When I try to define a review form that selects the Isiblings and Parent of GroupA-Adj I hit a problem.
    It seems that Children, IChildren, ILvl0Descendants, Descendants and IDescendants works as I would expect.
    Using IAncestors and IParents return just the User Variable setting (i.e. just the 'I' part, not the parents or Ancestors).
    Siblings, Isiblings, Parents, Ancestors all result in an error message because not all dimensions are represented in the form.
    This prevents me using a User Variable to build the review form in which I would like to display the siblings and parent of the entity GroupA-Adj.
    Anyone got any ideas?

    I would love to see the ability to select EDA's from Planning Forms, it would definately make life a little easier.
    As CL says, attributes are great at filtering forms and BR's, their only drawback is that you can only use them on sparse dimensional members.
    To get round this problem i've relied on security to filter out the accounts i do not need to see in the forms for the specific users, and kept the form selection on @IDESCENDANTS(Account_Parent).
    If you wish to filter on the Period dimension and this is a dense dimension, can you not get round the problem with rollups and, for example, @DESCENDANTS(Q1) to only return 3 months in the form, it really depends on your outline structure.

  • Using Bind Variable in Select List

    Hi
    I am using Jdev 11.1.1.5 . I am trying to create a view object with select column being populated using the bind parameter.
    Below is the code that i am using for creating View-Object as i want the parameter that user is passing while executing the view object should be displayed to user as a column
    SELECT TestPEO.<Column Name>,
           TestPEO.<Column Name>,
           :pStartDate PARAM_START_DATE,
           :pEndDate PARAM_END_DATE
    FROM <Table Name> TestPEOFor setting the above bind parameter i tried over-riding prepareRowSetForQuery method with default values being passed but it didnt helped out....Getting error " java.sql.SQLException: Missing IN or OUT parameter at index:: 1"
        public void prepareRowSetForQuery(ViewRowSetImpl vrs) {
        vrs.ensureVariableManager().setVariableValue("pStartDate",  new Date((new java.util.Date()).getTime()));
        vrs.ensureVariableManager().setVariableValue("pEndDate",  new Date((new java.util.Date()).getTime()));
        super.prepareRowSetForQuery(vrs);
        System.out.println("query "+getQuery());
        }Any idea regarding it will be helpful.. Please share your views in case there is any other approach to it.
    Thanks
    AJ

    Got it working.... :)
    Thanks

  • Simple Question -- How to use global variables in an another function??!

    Function named globalLeftMargin that has:
    Global NumberVar LeftMargin := 5;
    HOW DO I USE THIS IN ANOTHER FUNCTION?  B/C IT DOES NOT RECOGNIZE IT AND GIVES THIS ERROR:
    The ) is missing.
    The other function is:
    Space(LeftMargin)

    Hi Ajay,
    Add WhilePrintingRecords at the beginning of each formula like:
    WhilePrintingRecords;
    Global NumberVar LeftMargin := 5;
    WhilePrintingRecords;
    Global NumberVar LeftMargin;
    Space(LeftMargin)
    Good luck,
    Brian

  • Using a variable to select array value

    Hey,
    Im fairly new to Java, and im doing a course in it at the moment. I have been set some homework to do, but ive got a little stuck ...what i have to do is create a program that randomly generates numbers between 1 and 10, and then i have made an array which has 10 values, and say number 1 comes up in the random number generation, i want array [1] to have the number of times 1 appears in it. Ive came up with the following, but i keep getting errors ...i think there is a problem with defineing the variable i as a long, then the array as an integer...
    int[] ar = {0,0,0,0,0,0,0,0,0,0};
    int a = 0;
    while (a<10)
    a++;
    long i = Math.round(Math.random()*10);
    ar[i] = i;
         System.out.println(ar);
    with that code i get these errors:
    found : long
    required: int
    ar[i] = i;
    ^
    C:\Website Projects\Java Work\test 1\Document.java:14: possible loss of precision
    found : long
    required: int
    ar[i] = i;
    if anyone could help me get this working i would be most greatful
    Thanks for your time,
    -Ross

    ah k thanks for the response :) ...ive managed to narrow it down to one error:
    public class random {
    public static void main(String[] args){
    int[] ar = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
    int i = 0;
    while (i < 10){
    int t = Math.round(Math.random()*10);
         int ar[t]++;}
         i++;
    System.out.println(ar);
    gives the error:
    C:\Website Projects\Java Work\test 1\random.java:8: ']' expected
         int ar[t]++;}
    ^
    1 error
    Tool completed with exit code 1
    Im pretty sure it just doesnt like the value of the Math.xxxx being int, i was told it requires long/double...i need to convert it somehow after its done the calculation, i think :-S
    Thanks,
    Ross

  • How to use variable in the LIKE function along with % operators

    Hi,
    Is there any way i can use the variable in the Like function. That means i have query like
    SELECT * FROM Device WHERE DeviceName LIKE %v_MediaName%;
    Here "v_MediaName" is the userdefined variable which contains string. I want to retrieve all the records from the "DEVICE" table whose DeviceName LIKE %v_MediaName%;
    If i put it in a single quotes '%v_MediaName%' then the v_MediaName will be treaded as a string instead of a variable. I am using this query in a Procedure.
    please help me out to resolve the issue.
    thanks

    LIKE '%'||v_MediaName||'%';
    Will not make use of the indexes though.
    Message was edited by:
    satishkandi

  • Variable screen in Planning Function for Integrated Planning

    Hi all.
    I have created a planning application with the WAD, based on an Input_ready Query. Manual planning works fine and even planning functions go well, using the command wizard.
    However, if I try to use a variable in a planning function and I set the parameter to pop-up the variable screen within the command wizard for a planning function, I get an 'uncaught exception'. An almost blank IE-window pops up which is supposed to display the variables, but it fails.
    Does anybody know how to solve this?
    Gr.,
    Marc.

    Hello Marc,
    do you still have this error? I encountered the same problem with SPS 9. Maybe you should install at least SPS 10. The variable popup works correct there.
    Best regards
    Martin

  • Simple use of variables in query

    Hi,
    i've just started using PL/SQL and as a long time user of TSQL the syntax is a bit confusing for me. I'm trying to test a simple query - using a variable to select some rows from a table. Lest assume that we have a table with data from different days and we want to view data from specific day.
    I could use:
    SELECT * FROM TABLE
    where TRADE_DATE = '2010-10-23'
    but what i would like to do is to pass the date value as a variable, in TSQL i'd just write:
    declare @trade_date datetime
    set @trade_date = '2010-10-23'
    SELECT * FROM TABLE
    where TRADE_DATE = @trade_date
    Could someone help me and write the last query using PL/SQL syntax?
    Also - it there some kind of a tutorial for people like me? comparison of simple queries written in both languages? tried to google it but didn't have luck.

    There are a couple of differences besides variable syntax. The variable would look like this in PL/SQL:
    declare
        v_trade_date date := DATE '2010-10-23';
    begin
        select * into ?????  -- see below
        from   table
        where  trade_date = v_trade_date;
    end;However the next difference is that PL/SQL does not implicitly return result sets to the client application, so you either have to select <b>into</b> a PL/SQL variable, or process the values in a loop, or explicitly return a ref cursor (or just do the processing in SQL statements within the procedure, without returning anything). I don't know much about T-SQL but I have the impression that in Oracle there is a stronger distinction between SQL (the interpreted query language) and PL/SQL (the compiled programming language) than the equivalents in SQL Server. Saubhik's example above is not PL/SQL (which you asked about) but plain SQL.
    Using the example of SQL*Plus, you might use a ref cursor like this:
    var r refcursor;
    declare
        v_trade_date date := DATE '2010-10-23';
    begin
        open :r for
        select *
        from   test_table
        where  trade_date = v_trade_date;
    end;
    print :ror
    var r refcursor;
    create or replace procedure p (p_out_results out sys_refcursor)
    as
        v_trade_date date := DATE '2010-10-23';
    begin
        open p_out_results for
        select *
        from   test_table
        where  trade_date = v_trade_date;
    end p;
    set autoprint on
    exec p(:r)Edited by: William Robertson on Oct 24, 2010 5:31 PM

  • How to use the variables of Function exit in the include program

    i have a problem of using the variables of a function exit in the include program..
    If i use those variables there will be an error indicating 'Field FEBVW_IN is unknown. It is neither in one of the specified tables nor defined by a DATA statement'. Please help... Below is the code of the function exit:
    FUNCTION EXIT_SAPLIEDP_202.
    ""Lokale Schnittstelle:
    *"  IMPORTING
    *"     VALUE(IDOC_CONTROL_INDEX)
    *"     VALUE(IDOC_DATA_INDEX)
    *"     VALUE(FEBVW_IN) LIKE  FEBVW STRUCTURE  FEBVW
    *"     VALUE(FEBKO_IN) LIKE  FEBKO STRUCTURE  FEBKO
    *"     VALUE(FEBEP_IN) LIKE  FEBEP STRUCTURE  FEBEP
    *"     VALUE(FEBRE_IN) LIKE  FEBRE STRUCTURE  FEBRE
    *"     VALUE(FEBPI_IN) LIKE  FEBPI STRUCTURE  FEBPI
    *"  EXPORTING
    *"     VALUE(I_FIMSG) LIKE  FIMSG STRUCTURE  FIMSG
    *"     VALUE(FEBVW_OUT) LIKE  FEBVW STRUCTURE  FEBVW
    *"     VALUE(FEBKO_OUT) LIKE  FEBKO STRUCTURE  FEBKO
    *"     VALUE(FEBEP_OUT) LIKE  FEBEP STRUCTURE  FEBEP
    *"     VALUE(FEBRE_OUT) LIKE  FEBRE STRUCTURE  FEBRE
    *"     VALUE(FEBPI_OUT) LIKE  FEBPI STRUCTURE  FEBPI
    *"  TABLES
    *"      IDOC_CONTROL STRUCTURE  EDIDC
    *"      IDOC_DATA STRUCTURE  EDIDD
    *"      IDOC_AVIP STRUCTURE  AVIP OPTIONAL
    *"      IDOC_AVIR STRUCTURE  AVIR OPTIONAL
    *"      IDOC_AVIT STRUCTURE  AVIT OPTIONAL
    *"  CHANGING
    *"     REFERENCE(IDOC_AVIK) TYPE  AVIK OPTIONAL
    *"  EXCEPTIONS
    *"      PROC_ERROR
      INCLUDE ZXF08U10.
    Here is the code for the include program.
      INCLUDE ZXF08U10
    MOVE febvw_in TO febvw_out.

    Sometimes you will get this error message when checking include code in exits even though there is really no error - it happens because the include does not realise it is in the function due to the navigation index being out of date.
    Try activating the code - it may work even though the check said there were errors.
    You can also get this issue when trying to drill down on the field in the include to view its structure.
    Andrew

  • How to use a table name in the select statement using a variable?

    Hi Everybody,
                       I got a internal table which has a field or a variable that gets me some tables names. Now I need to retrieve the data from all these tables in that field dynamically at runtime. So could you suggest me a way out to use the select query which uses this variable as a table ?
    Regards,
    Mallik.

    Hi all,
    Actually i need some more clarification. How to use the same select statement, if i've to use the tabname in the where clause too?
    for ex : select * from (tab_name) where....?
    Can we do inner join on such select statements? If so how?
    Thanks & Regards,
    Mallik.

  • Using Bind Variable in a SELECT

    Hi,
    I'm trying to build up my SQL query at run-time using bind variables and in the Oracle® Fusion Middleware Fusion Developer's Guide for Oracle Application Development Framework 11g Release 1 (11.1.1) it says that 'After defining the bind variables, the next step is to reference them in the SQL statement. While SQL syntax allows bind variables to appear both in the SELECT list and in the WHERE clause, you'll typically use them in the latter context, as part of your WHERE clause.'.
    However, when I try to use the bind variables in my SELECT list because I've had to set a type for the variable to String the variable gets inserted with inverted commas either side e.g. SELECT 'Service' FROM TestTable. Is it possible to use bind variables to insert a value into my select list without these inverted commas around it?
    Thanks in advance,
    Tom

    OK, thanks for your response. Do you know of a way then where I can control my SELECT parameters programmatically? I'm currently trying to do it using the information in the chapter '35.9 Using Programmatic View Objects for Alternative Data Sources' from the Oracle® Fusion Middleware Fusion Developer's Guide for Oracle Application Development Framework 11g Release 1 (11.1.1). I think I'm part way there, would this be the correct way of acheiving what I want?
    Cheers, Tom

  • Using variable in select statement (php)

    I am having difficulty using a variable in a select
    statement.
    The following manual query (using a static date) works fine:
    $query_Recordset1 = "SELECT * FROM academyClasses WHERE
    classDate > '2006-06-01' ";
    However, If I use the following:
    $dateVar = date('Y-m-d');
    mysql_select_db($database_mw, $mw);
    $query_Recordset1 = "SELECT * FROM academyClasses WHERE
    classDate > $dateVar ";
    ALL records are returned, which means the $dateVar variable
    is not being recognized. I have compared the $dateVar values
    <?php echo $datetime; ?> against the actual value of my date
    field <?php echo $row_Recordset1['classDate']; ?> in my
    results table and it seems that the values are indeed accurate in
    terms of a date 2006-06-04 for example.
    My date field "classDate" is of a "date" type within the
    mysql database. I'm using Dreamweaver MX 2004 with Mac OSX 10.3.9.
    I'm sure this is just a syntax problem, at least I hope it
    is.
    Any help is greatly appreciated.

    On Wed, 7 Jun 2006 04:49:57 +0000 (UTC), "mgwaters"
    <[email protected]> wrote:
    >Thanks Gary. That did seem to get the select statement
    working, but I had to
    >enter a manual date as before $dateVar = '2006-06-01'; on
    the previous line of
    >code to actually get it to filter my records. So... it
    looks like my setting of
    >the date variable:
    > $dateVar = date('Y-m-d');
    > does not seem to be recognized within the SELECT
    statement.
    Try this:
    $query_Recordset1 = "SELECT * FROM academyClasses WHERE
    classDate>'$dateVar'";
    print $query_Recordset1;
    See what is in the SQL statement.
    Gary

  • How to  use data function using characterstics variable for calculation on

    how to  use data function using characterstics variable for calculation on  attribute as key figure

    Hi Gayatri
    Did you not see my answer for CASE because CASE does indeed offer the use of the BETWEEN clause, but DECODE does not. Let me give you a little synopsis of DECODE.
    In its most simple form it takes 4 values and looks like this: DECODE(A, B, C, D)
    This essentially means, IF A = B THEN C ELSE D
    The trick to solving BETWEEN in a DECODE is to work out algoriths where A = B. Because we don't know how many values are between 00 and 99, although I could guess there were 100 we could of course have 100 parts in the DECODE but that would be awful. How about if we look at it another way and say this:
    IF PART_NUMBER < 'SDK00' THEN pay_amount
    ELSE IF PART_NUMBER > 'SDK99' THEN pay_AMOUNT
    ELSE pay_amount + 100
    This statement only had 2 hard coded values, but how to make DECODE work with less than? Easy, we use the LEAST function. The LEAST function takes 2 values and returns the one with the lowest value. So I use LEAST(PART_NUMBER, 'SDK00') then whenever the PART_NUMBER is lower than SDK00 it will be true. A similar situation exists for the opposite function GREATEST. Putting all of this together then, you can do this:
    DECODE(PART_NUMBER, GREATEST(PART_NUMBER, 'SDK00'), DECODE(PART_NUMBER, LEAST(PART_NUMBER, 'SDK99'), PAY_AMOUNT * 100, PAY_AMOUNT), PAY_AMOUNT)
    In English this can be read as follows:
    IF the PART_NUMBER is greater than or equal to SDK00 and the PART_NUMBER is less than or equal to SDK99 THEN PAY_AMOUNT x 100 ELSE 0
    Best wishes
    Michael

Maybe you are looking for