Calling a function that's inside another function

function test1():void
     function test2():void {..}
How do I call test2 function (outside test1 function)? Is it possible?

Hi,
yes it is possible.
Here is the code helps u
function foo():Function
var x:int = 40;
function rectArea(y:int):int // function closure defined
return x * y
return rectArea;
var myProduct:Function = foo();
var s = myProduct(4);
trace(s);
Saransoft

Similar Messages

  • Calling a procedure that exist in another schema

    hello , i need your help .
    i would like to know how i can call a procedure that exist in another schema
    what i did for example calling the procedure "proc" at schema "user1" from pl/sql code
    begin
    user1.proc(parm1,parm2);
    end;
    i got the error message
    (1): PLS-00201: identifier 'user1.proc' must be declared
    (2): PL/SQL: Statement ignored
    but by calling it from SQL PLUS from the same current schema i got no errors
    exec user1.proc(parm1,parm2);
    thank you

    Assuming that the call that is failing is located in a stored procedure or stored function, the problem is likely that your user's access to the user1.proc procedure is via a role and privileges granted through a role cannot be used in a definer's rights stored procedure or stored function.
    You can verify this by disabling roles in your SQL*Plus session. If you do
    SQL> set role none
    SQL> exec user1.proc( p1, p2 );I would expect that you'll get the same error that you get in your stored procedure. Assuming that is the case, you'll need to ask the DBA to grant your user EXECUTE access on user1.proc directly not via a role.
    Justin

  • Signal function on complete of another function

    Argh.. This seems pretty easy but I cannot find information about this anywhere.  I might just be searching wrong..
    Anyway, I'd like to signal a function to run when another function completes.
    I am filling a scrollPane with some dynamic content and want it to resize once the content has filled in some dynamic text boxes.
    I'd like to signal a resize function once the function that fills in the scrollPane completes.  I tried something like this but it does not seem I can add this sort of listener to a funciton.
    scrollPanePopulate.addEventListener(Event.COMPLETE, scrollPaneResize);
    I might be missing something obvious or just be headed down the wrong path.  Thanks in advance..
    -j

    function scrollPanePopulate(event:Event):void{
    //show scroll pane
         scrollPane.visible=true;
    //create the temp variables
         var calledMarkerIndex=pntxml.row[pointindex].ID;
         var calledMarkerDate=pntxml.row[pointindex].DATE;
         var calledMarkerDescription=pntxml.row[pointindex].DESC;
         var calledMarkerContent=pntxml.row[pointindex].URL_OF_CONTENT;
         var imgSource:String = "<img src="+"'"+calledMarkerContent+"'"+"width='405'"+"height='280'"+"/>";
    //fill in the text
         scrollPaneContent.scrollPaneImage.htmlText=imgSource;
         scrollPaneContent.scrollPaneText.htmlText="<font size='12' color='#ffffff'>"+calledMarkerDescription;
         scrollPane.update();
         scrollPane.verticalScrollPosition=(0);
    and something like this would size my scrollPane to a reasonable size
    function scrollPaneResize(event:Event):void{
    //resize the scrollpane to content's size
         var imgHeight=scrollPaneContent.scrollPaneImage.height;
         var txtHeight=scrollPaneContent.scrollPaneText.height;
         var contentHeight=(imgHeight+txtHeight);
         scrollPane.setSize(510,(contentHeight+50));
    Finally..  What I'll ultimatley do is set this up so that if the two componenent in my scrollPane are too large (height+height) then I'll have a maximum size that the scrollPane can attain

  • Is it possible to call a VI that is inside a LabVIEW executable from a TestStand sequence?

    I have created a custom TestStand operator interface and have modified the default sequential process model to display a UUT information dialog that prompts for more information than just the UUT serial number.  This UUT information dialog is a LabVIEW VI.  To distribute the operator interface, I build it into an executable.  As part of the build process, I make a copy of the UUT information dialog VI (which is part of my operator interface project) and place it in the same folder as the executable.  I have then configured the sequential process model to call the dialog VI from this location.  It would be really nice if I could embed the UUT information dialog VI inside the operator interface executable so that I could distribute just an executable instead of an executable and separate VIs.  Is this possible?  In other words, is it possible to call a VI that is inside a LabVIEW executable from a TestStand sequence just like a standard LabVIEW VI call?

    Ryan,
    The dialog that you've created isn't being directly called by the OI at all and shouldn't need to be included in the same directory as the OI for distribution. Since you are modifying the PreUUT of the default process model, you will give the path to the VI in that step, create a deployment and then manually copy the VI to the directory referenced in the step. The VI is considered a support file for the process model and is not related to the OI at all.
    Test Engineer - CTA

  • How to call 1 function from1 system into another function of another system

    tell me the solution.......
    Moderator message : Not enough re-search before posting. Thread locked.
    Edited by: Vinod Kumar on Jun 13, 2011 2:08 PM

    In the Function 1 of System 1, you can call using below syntax..
    CALL FUNCTION 'Function_name'  DESTINATION
    Function_name is Function 2 and Destination is Address of second system

  • Can I call a selection-screen that is in another function group?

    I am writing a function module in function group ZFG_A.
    There exists a Dypro 9001 that exists in function group ZFG_B.
    How can I call the dynpro 9001 from my function in ZFG_A?
    This is not OO so I am not sure how to qualify the 9001?  Such as ZFG_B=>9001
      call selection-screen 9001 starting at 5 5
                                 ending   at 70 15.
    I get compile errors on the selection-screen variables because they are not found.
    Thank you,
    Olivier

    Its not at all possible to call a screen of different program from other program.
    But u can copy the screen using a FM called 'RS_SCRP_COPY' or 'RS_SCREEN_COPY'. In the former u can copy the screen with out popup but u have to specify the SOURCE program name and screen number and TARGET program name and screen no.
    In the later u ll get the popup similar to when u copy a screen in SE51.In the popup as u know u have to enter source name and screen no. and target program name and screen no.
    Thanks & Regards
    Santhosh

  • Can't call a function inside another function

    Hello,
    i have the following function :
    FUNCTION test_day_week (P_DATE DATE)
    RETURN VARCHAR2 IS
    BEGIN
    RETURN TO_CHAR(P_DATE ,'DAY');
    END;
    --it returns the day name of a given date
    FUNCTION TEST_DAY_NUMBER (P_DAY_NAME VARCHAR2)
    RETURN NUMBER IS
         V_RESULT NUMBER;
         V_RETURN_DAY VARCHAR2(30);
         P_DATE DATE;
    BEGIN
    V_RETURN_DAY := test_day_week (P_DATE );
    MESSAGE('V_RETURN_DAY'|| V_RETURN_DAY);
    MESSAGE('V_RETURN_DAY'|| V_RETURN_DAY);
    IF V_RETURN_DAY = 'MONDAY' THEN V_RESULT :=1;
         END IF ;
    IF V_RETURN_DAY = 'TUSEDAY' THEN V_RESULT :=2;
         END IF ;
    IF V_RETURN_DAY = 'WENDSDAY' THEN V_RESULT :=3;
         END IF ;
    IF V_RETURN_DAY = 'THURSDAY' THEN V_RESULT :=4;
         END IF ;
    IF V_RETURN_DAY = 'FRIDAY' THEN V_RESULT :=5;
         END IF ;                
    IF V_RETURN_DAY = 'SATURDAY' THEN V_RESULT :=6;
    END IF ;
    IF V_RETURN_DAY = 'SUNDAY' THEN V_RESULT :=7;
         END IF ;
    RETURN V_RESULT;
    END;
    --The above function returnds the day name in numbers
    The proble is that when i call test_day_week function it returns no value even it is tested separatly and works fine don't know where is my problem :
    1-number of argrments in function[b] TEST_DAY_NUMBER
    ?? and so ..!
    Regards,
    Abdetu..

    You could also cut the whole thing down to a simple function... (assuming you have a need to customise your start of week rather than use built in date functionality)
    SQL> ed
    Wrote file afiedt.buf
      1  CREATE OR REPLACE FUNCTION test_day_week (P_DATE DATE) RETURN NUMBER IS
      2  BEGIN
      3    RETURN (INSTR('MONTUEWEDTHUFRISATSUN',TO_CHAR(P_DATE,'DY'))+2)/3;
      4* END;
    SQL> /
    Function created.
    SQL> select test_day_week(sysdate) from dual;
    TEST_DAY_WEEK(SYSDATE)
                         1
    SQL> select test_day_week(sysdate+1) from dual;
    TEST_DAY_WEEK(SYSDATE+1)
                           2
    SQL> select test_day_week(sysdate+2) from dual;
    TEST_DAY_WEEK(SYSDATE+2)
                           3
    SQL> select test_day_week(sysdate+3) from dual;
    TEST_DAY_WEEK(SYSDATE+3)
                           4
    SQL> select test_day_week(sysdate+4) from dual;
    TEST_DAY_WEEK(SYSDATE+4)
                           5
    SQL> select test_day_week(sysdate+5) from dual;
    TEST_DAY_WEEK(SYSDATE+5)
                           6
    SQL> select test_day_week(sysdate+6) from dual;
    TEST_DAY_WEEK(SYSDATE+6)
                           7
    SQL> select test_day_week(sysdate+7) from dual;
    TEST_DAY_WEEK(SYSDATE+7)
                           1
    SQL>

  • Help with calling a java application from inside another one

    Hello!
    I am having this problem which is getting on my nerves and dont know how to solve..
    I want to call from my java application, another java application. So i use the exec command. Then i want to read the output of this execution from my own application, (the "parent" process).
    But it doesn work properly. Something seems to happen and i dont get the whole output.
    The java program i want to call is created for running an application created with Matlab java builder.
    This program works when called from cmd, but seems not to work when called from inside a java application.
    The code of my java application is:
    Runtime rt = Runtime.getRuntime();
    Process child;
    // The java class getmagic is a special kind of java file that uses classes that work in matlab. It uses a component (.jar) file that is created from matlab java builder. thats why it wants the -classpath and the rest options.
    //I hope you wont get messed up in here.
    String[] callAndArgs = {"java","-classpath",".;C:\\Program Files\\MATLAB\\R2006b\\toolbox\\javabuilder\\jar\\javabuilder.jar;..\\MagicDemoComp\\magicsquare\\distrib\\magicsquare.jar -Djava.library.path=C:\\Program Files\\MATLAB\\R2006b\\bin\\win32;","getmagic","4"};
    try{
    child = rt.exec(callAndArgs);
    InputStream is = child.getInputStream();
    InputStreamReader isr = new InputStreamReader(is);
    BufferedReader br = new BufferedReader(isr);
    String line;
    while ((line = br.readLine()) != null)
    System.out.println(line);
    is.close();
    System.out.println(child.waitFor());
    System.out.println("Finished");
    }catch(IOException e) {
    System.err.println("IOException starting process!");
    }catch(InterruptedException e) {
    System.err.println("InterruptedException starting process!");
    The java program (getmagic) thats uses matlab gives the following output (after some time) when called in cmd with argument 4
    Magic square of order 4
    16 2 3 13
    5 11 10 8
    9 7 6 12
    4 14 15 1
    My program shown above only prints:
    Magic square of order 4
    1
    Finished.
    Do i do something wrong? How can i get the rest of the output???
    Thank you very much in advance,
    Stacey
    PS: I am sorry for the length of my post.

    Hello CaptainMorgan08, thanx for the instant reply.
    I tried, but no, i cant.
    Because i cannot include this java aplication that uses matlab into my application, cause 1) it needs special arguments in the compiler and during execution so it can be run and 2) it uses classes that java doesnt have. only the java-like matlab code.
    For example it uses:
    import com.mathworks.toolbox.javabuilder.*;
    import magicsquare.*; //the component which is made from matlab java builder.
    So i cannot compile it with my application!
    If you know of a way, please let me know!
    I know i might be missing something.. something that is obvious to you.. but i ve been working days=nights hardly no sleep..so you can excuse me if i say something foolish..
    Message was edited by:
    Stacey_Gr

  • Problems calling LabVIEW VI through ActiveX inside another LabVIEW VI

    Hi everybody,
    basically I would like to create an ActiveX to be inserted in a LabVIEW VI which at its turn would call another LabVIEW VI.
    I have choosen Visual Basic to create this ActiveX, being the main section code:
    Dim lv As LabVIEW.Application
    Dim vi As LabVIEW.VirtualInstrument
    Dim names(0 To 1) As String, values(0 To 1) As Variant
    'Assign an object reference to VI
    Set lv = New LabVIEW.Application
    'Assign an object reference to VI
    Set vi = lv.GetVIReference(lv.ApplicationDirectory & "\Examples\General\Strings.llb\Parse Arithmetic Expression.vi")
    vi.ShowFPOnCall = False 'Open front panel if requested
    'Initialize the variables & define the strings corresponding to the VI connector labels.
    names(0) = "Arithmetic Expression": values(0) = "1+1"
    names(1) = "Result"
    'Call the VI
    vi.Call names, values
    So, when this ActiveX executes this code sequence it locks when creating the "LabVIEW. Application" object. I have tested this ActiveX from another client application (Internet Explorer) and it works perfectly, so the problem is located in the creation of ActiveX from LabVIEW. Do I need to do anything special in my code or simple it cannot be done what I want to do?
    Thanks !!!
    Jesus Valero
    Plataforma Solar de Almeria.

    Exactly, but really the code of above it's only an example that I want to do. I'm trying something more sophisticated.
    I want to create an ActiveX control that could work as stand alone executation with the ability of directly get some indicator values from its LabVIEW VI container and depending of those values, set the control values of others LABVIEW VIs. I really know that within LabVIEW itself I can get/set those indicators/controls, but with this method I think that the diagram block of the LabVIEW VI container can be more simple.

  • Call of a BADI method inside another BADI

    Dear colleagues,
    Could someone guide me with the information whether it is allowed to create/call  a Badi inside an implementation of another Badi method?
    Please let me know whether there are other alternatives or the Badi call within Badi acceptable as per SAP standards?
    Many thanks in advance,
    Best regards,
    Srivatsa

    hi Ganesh,
    Check this out
    <b>Calling a BADI from another BADI</b>
    Regards,
    Santosh

  • How to replace F4 using another function key

    Experts:
       How can i change the search help function key F4, using another function key,for example F11, when i press F11 the system perform the search help.
    thanks!

    you can do this using menus/buttons(dialog programming) and there you can define your short keys, and event can be trapped by sy-ucomm in the program. Menu can be set by writting set PF-Status 'MENUNAME' or using se37.

  • How to access a variable from inside another symbol

    So i did this tutorial, Leveraging Independent Symbol Timelines created by Eliane...it's rockin, btw.  ;-)
    All's well but now i have a symbol on the stage called mc-home.  inside of mc-home is a button called btn-go.
    On the stage in composition ready there's a variable sym.setVariable("current", "mc-home");
    This code works for a symbol that's on the stage but, how do i get this code to work on a button that's inside another symbol that's on the stage?
    var current = sym.getVariable("current");
    if (current != "") {
        sym.getSymbol(current).play("OUT");
    sym.getSymbol("mc-something").play("IN");
    sym.setVariable("current", "mc-something");

    sorry, i was kind of confused myself too, don't worry about it but thanks for your patience for reading it anyway

  • Dont ask why! How do I call an applet that is in a jar file that is...

    Can someone tell me how I would call an applet that is inside of a jar file that is inside of a parent jar file?
    example call to an Applet
    <APPLET CODE="TimeApplet" ARCHIVE="time.jar" />what I want to do is something like
    <APPLET CODE="TimeApplet" ARCHIVE="parent.time.jar" />
    where parent is the top jar and time is the inner jar.any help or links to tutorials/articles would be most appreciated.
    if you ask why I wont answer.

    we are doing a signed applet and we only want the user to have to sign 1 time
    and we have lots of applets to display so we dont want to have them sign for
    each item.Sorry but that doesn't make much sense, niether does putting a jar file in a jar file.
    Do you want the "do you trust" question only one time? If so than you only have
    to sign all the jar files with the same key.
    You can load a jar file from your applet but it seems that these jar files will run
    in sanbox security no matter how you sign it:
    http://forum.java.sun.com/thread.jspa?messageID=3582952
    Asking why does make sense, I coud be asking how to climb a building without
    telling my objective is to get on the 10th floor.
    You would tell me how to climb the building an I'd probably do it and find out
    later I could just as well have taken the elivator.

  • Calling a function inside another class

    I have the following two classes and can't seem to figure to figure out how to call a function in the top one from the bottom one. The top one get instantiated on the root timeline. The bottom one gets instantiated from the top one. How do I call functions between the classes. Also, what if I had another call instantiated in top one and wanted to call a function in the bottom class from the second class?
    Thanks a lot for any help!!!
    package
         import flash.display.MovieClip;
         public class ThumbGridMain extends MovieClip
              private var grid:CreateGrid;
              public function ThumbGridMain():void
                   grid = new CreateGrid();
              public function testFunc():void
                   trace("testFunc was called");
    package
         import flash.display.MovieClip;
         public class CreateGrid extends MovieClip
              public function CreateGrid():void
                   parent.testFunc();

    kglad,
    Although I agree that utilizing events the way you attempted in your suggestion is better for at least a reason of eliminating dependency on parent, still you code doesn't not accomplish what Brian needs.
    Merely adding event listener to grid instance does nothing - there is no mechanism in the code that invokes callTGMFunction - thus event will not be dispatched. So, either callTGMFunction should be called on the instance (why use events - not direct call - in this case?), or grid instance needs to dispatch this event based on some internal logic ofCreateGrid AFTER it is instantiated - perhaps when it is either added to stage or added to display list via Event.ADDED. Without such a mechanism, how is it a superior correct way OOP?
    Also, in your code in ThumbGridMain class testFunc is missing parameter that it expects - Event.
    Am I missing something?
    I guess the code may be (it still looks more cumbersome and less elegant than direct function call):
    package
         import flash.display.MovieClip;
         import flash.events.Event;
         public class ThumbGridMain extends MovieClip
             private var grid:CreateGrid;
             public function ThumbGridMain():void
                 grid = new CreateGrid();
                 grid.addEventListener("callTGMFunction", testFunc);
                 addChild(grid);
            // to call a CreateGrid function named cgFunction()
             public function callCG(){
                 grid.cgFunction();
             public function testFunc(e:Event):void
                 trace("testFunc was called");
    package
         import flash.display.MovieClip;
         import flash.events.Event;
         import flash.events.Event;
         public class CreateGrid extends MovieClip
             public function CreateGrid():void
                 if (stage) init();
                 else addEventListener(Event.ADDED, callTGMFunction);
             // to call a TGM function
             public function callTGMFunction(e:Event = null):void
               // I forgot this one
                removeEventListener(Event.ADDED, callTGMFunction);
                this.dispatchEvent(new Event("callTGMFunction"));
            public function cgFunction(){
                 trace("cg function called");
    I think this is a case of personal preference.
    With that said, it is definitely better if instance doesn't rely on the object it is instnatiated by - so, in this case, either parent should listen to event or call a function directly.

  • Calling another function if upate statement fails

    Hi there,
    I have written an update procedure and insert procedure. Is there a way of calling another function if the update statement fails? Thanks a lot for your help.
    Chris
    procedure update_costing(in_period in DATE,
                   in_project_id IN VARCHAR2,
                   in_user_id IN VARCHAR2,
                   in_thu IN VARCHAR2,
                   in_fri IN VARCHAR2,
                   in_sat IN VARCHAR2,
                   in_sun IN VARCHAR2,
                   in_mon IN VARCHAR2,
                   in_tue IN VARCHAR2,
                   in_wed IN VARCHAR2)
         UPDATE TBL_COSTING
              SET
                   HOURS_THU = to_date (in_thu, 'HH24:MI'),
                   HOURS_FRI = to_date (in_fri, 'HH24:MI'),
                   HOURS_SAT = to_date (in_sat, 'HH24:MI'),
                   HOURS_SUN = to_date (in_sun, 'HH24:MI'),
                   HOURS_MON = to_date (in_mon, 'HH24:MI'),
                   HOURS_TUE = to_date (in_tue, 'HH24:MI'),
                   HOURS_WED = to_date (in_wed, 'HH24:MI'),
                   WHERE PERIOD = in_period
         AND PROJECT_ID = in_project_id
         AND USER_ID = in_user_id;
    EXCEPTION
    --CALLL HERE THE INSERT FUNCTION WITH SAME DATAMEMBERS
    SOMETHING LIKE THIS---
    WHEN others then
         insert_costing(in_period, in_project_id, in_user_id ,in_thu,in_fri,in_sat,in_sun,in_mon,in_tue,in_wed ,in_submit);
    COMMIT;
    END update_costing;

    begin
    UPDATE statement
    IF SQL%ROWCOUNT =0
    then
    INSERT statement|procedure
    end if;
    end;
    /Hi,
    i have a simple doubt over here, i read somewhere that cursor attributes can be used only as long as the cursor is open, then in the above case whiel doing the update operation, oracle implicitly will open an cursor and will do the operation and then will close the cursor, then how does SQL%ROWcount works???please revert...
    cheere

Maybe you are looking for

  • Issues with Adobe and their Acrobat XI Pro product

    A couple of problems I am having with Adobe products. First, you tell me I can't get Acrobat XI Pro in Papua New Guinea and yet you allowed me to have the free trial. Now I want to buy it and you won't let me. Second, your chat which says is availabl

  • Gradient tool doesn't work with gradients on strokes?!

    Okay, so one of the new flagship features of Illustrator CS6 is gradients on strokes, but you can't use the Gradient Tool with them? I just get a crosshairs pointer with a "no" sign next to it. What's up with that?? I can see why this wouldn't work w

  • My responce to Apple's request to try Photos as an Aperture user

    From what I've seen and read from reviewers regarding the new Photos App, I currently have no interest. Maybe that will change but I am totally dismayed you would completely give up on the professional market and thoroughly dismantle a truly name bra

  • TS2446 I purchased an I phone from a friend of mine that is locked. How do I unlock it?

    I purchased an Iphone 3 from my buddy, it is locked up and he doesnt remember the password. How do I unlock it for my own use?

  • BW HIERARCHY IN BPS

    Hi people, I have created a hierarchy in bw.It goes like this. Region->State->Product. I am working on planning for a product which has its presence in 4 regions(north,south,east,west) .Each region comprise of 3 states. I was able to create a hierarc