functions called by events in the context of the caller?

Hello

Imagine I have class that is listening for an event on the class B. This listener will call method X in the class a. within method X, 'this' refers to the Instance of class B, I'm not in the context of the class a. isn't it a little tricky, or I hurt myself? Is there a way to make the listener call my method in the context of A?

Thank you very much for your attention, hope someone can clear up my mind about this

Paulo

You can use the delegate class to maintain the scope.  Use google to check the use of Delegate.create

Tags: Adobe Animate

Similar Questions

  • How to implement a callback to the help function call library function node in LabView?

    I try to call a fuction from a SDK.dll library by using the node call library feature. The SDK has been provided to

    me and I don't have the source code, just the .dll and .h files.

    The SdkSetPropertyEventHandler function has a function of recall as one of its parameters. How to apply the

    callback using the NSI node? I'm a good programmer LabView but this is my first time using the library to call

    Function node. I read all the info I can find on the web site of NOR and the discussion Forum, but can not understand

    This one out. I'm using LabView 8.6.

    The deacribes SDK.h function as:

    Function: SdkSetPropertyEventHandler

    (SdkSetPropertyEventHandler) SdkError SDKAPI
    SdkCameraRef inCameraRef,
    SdkPropertyEvent inEvnet,
    SdkPropertyEventHandler inPropertyEventHandler,
    SdkVoid * context);

    //
    Description:
    Registers a callback function to receive the status
    change the notification events for the States of property on a camera.
    //
    Parameters:
    In: inCameraRef - designate the object camera.
    inEvent - designated one or all the events will be completed.
    inPropertyEventHandler - designate the pointer to the callback
    function to receive the camera property-related events.
    inContext - designated application information must be passed
    way to the callback function. All the data necessary to
    your application can be passed.
    Output: no
    //
    Returns: A sdk errors.
    -----------------------------------------------------------------------------*/

    A separate header called SDKTypes.h file contains the following data:

    typedef SdkUInt32 SdkPropertyEvent;
    typedef SdkUInt32 SdkPropertyID;
    typedef void SdkVoid;

    typedef struct __SdkObject * SdkBaseRef;
    typedef SdkBaseRef SdkCameraRef;

    /*-----------------------------------------------------------------------------
    SdkPropertyEventHandler
    -----------------------------------------------------------------------------*/
    typedef SdkError (SDKCALLBACK * SdkPropertyEventHandler))
    SdkPropertyEvent inEvent,
    SdkPropertyID inPropertyID,
    SdkUInt32 inParam,
    SdkVoid * context);

    Thanks for your help.
    Alejandro

    Andrew_E wrote:

    Hi Rolfk,

    You are absolutely right. This article describes what you were talking about? I'm just trying to get as much information as possible on this thread if the solution is easier to find for the future. Thank you.

    Yes, but I find the idea of using .net to call a LabVIEW VI as callback function C a bit as using a roll of Steam ironing your pants. Why do it? Well the steamroller has extra security guards that make it less likely that you'll break your pants in the process, but it's not elegant IMHO.

    Write a C DLL that translates between a C callback and a user event LabVIEW using the PostLVUserEvent() of the interface of the kernel to run LabVIEW function seems so eleganter for me. Yes, it's a bit of programming in C, but good!

    Rolf Kalbermatter

  • Passing Parms of event click the function and 'child '.

    With the help on this Forum, I'm able to pass the parms in a custom context menu based on TitleWindow created with the PopUpManager to a click event.  Now, I would also spend parms to change a Manager click on the PopUp itself event.  Is this possible?  Here is the code for the click event in the context menu:

    From main MXML file - creates the PopUp:

    private

    var popup: owPopUp = new owPopUp();

    protected function owPopUpWindow (event: MouseEvent, title: String, url1:String):Sub

    {

    PopUpManager.addPopUp (popup,

    ce , true );

    Popup.title = title;  title = '{text}' in the tag < s:TitleWindow... >.

    Popup.x = 200;

    Popup.y = 125;

    }

    Code for the click (a text in a text box) event

    a click = "owPopUpWindow (event, '.

    ' New EBS: order writer - queue of Milestone 1' "lessons/EBS_new_Milestone1.swf" ) "//third parm is what I want to pass to the function in the PopUp TitleWindow (underline) .

    In the TitleWindow PopUp created by the above code:

    ...

    [

    Bindable [ ] public var titleText:String =""; .

    [Bindable] public var url1:String = "";

    protected

    function textarea1_clickHandler(event:MouseEvent):

    Sub

    {

    ce .move (1,1);

    Loader.Load)

    'url1' );  This URL is where I would like to pass in a parm to the event click above 'url1 '.

    }

    protected function pdfLoader(event:MouseEvent):Sub

    {

    navigateToURL (new URLRequest (url2));  I would also like to pass parm for this URL 'url2.

    }

    The role of title works, but does not work part url1.  No error, just no load.  Any suggestions?

    Thank you.

    Create your own event accommodating more parms.

    This is possible by creating a class that extends MouseEvent.  Add some parms you need for this event and be sure to call super.

    You can then send this event as need and also get the parms that you must listen to

    http://StackOverflow.com/questions/426540/how-to-create-custom-MouseEvent-click-event-in-a s3 pass parameters of function

    #4 comment should help you.

  • XNET Config read to fill in when a certain arbid is received (i.e. return of function call when the msg is received)

    The API XNET-CAN allows to hardware configuration such that a call to read the framework/signal does not return until the message is received (no need to query the buffer, call to the function is as an event... function returns when a message is received) or if a time-out occurs).  I don't really want to query for data, unless I absolutely have to.  My plan is to have parallel code to wait for a specific message to receive and respond (should be very fast!) whil a different loop receives all other executives.

    A time-out of the reading function call would work pretty good, but it doesn't seem to work (see extracts attached).  The value of timeout only seems to work (no error property) is a value of 0 seconds.

    Thank you

    Todd

    Change of a single point of session for a queued session.

  • How can I access the data associated with an event within the event handler function?

    Hello

    In my LabWindows code, I try to use a DLL that has been developed in .NET (c#).  I used the built-in labwindows Wizard that converts the DLL to a usable 'instrument'.  Almost everything seems to work, except that I have 1 problem.

    There is an event (defined in the DLL) that I am able to detect.  I know that the reminder of the event is called at the right time.  But the problem is that in this function, I can't access the data that is supposed to be attached to the event.  It worked fine in c#, but I don't know how to do in LabWindows.  Here's what looked like in c# event handler function:

    void AppLoaderEventCallback (CommonLib.CommandResult MyResults)

    {

    MyResults is used in the body of this function

    }

    But in LabWindows, I can't seem to access the MyResults data structure.  Here's what I do:

    public static int CVICALLBACK AppLoaderEventCallback (CommonLib_CommandResult MyResults)

    {

    I can't access MyResults here

    }

    Can you help me with this?  I'm doing something wrong?

    Thank you very much for your help.

    -Mike

    I think that your statement of callback function is perhaps not quite correct. Look using the parameter "callback function" function Panel of the generated __Create function associated with this event. This shows the declaration of the callback function - make sure that your callback function is declared in the same way.

  • Function call only the last Javascript API

    All,

    I have a function in my page header:

    function DisableANo() {}
    1
    $f_DisableOnValue ('P20_B', 'AAAA', 'P20_A');

    2
    $f_DisableOnValue ('P20_B', 'BBBB', 'P20_A');

    3
    $f_DisableOnValue ('P20_B', 'CCCC', 'P20_A');

    }

    I call this function onChange event of the B element.
    When I do this, only the last API //3 is called. If I delete //3 and have only //1 and / / 2, then I get //2 to work and if I remove //2 and I only / / 1, then I can get //1 to work.

    Can you please tell me where I'm wrong?

    Thank you!

    Spriya wrote:
    Hello

    I am trying to disable the P20_A element if the value of the P20_B element is "YYYY" or "BBBB" and "CCCC".

    Review of documentation:
    >
    $f_DisableOnValue (pThis, pValue, pThat)

    Checks the value (pValue) of an element (pThis). If it matches, this feature disables the element or the array of items (pThat). If it does not match, the item is enabled.
    >
    In this code (and code should always be validated using ------)

    ...\
    

    Tags :)

    function DisableANo(){
    //1
    $f_DisableOnValue('P20_B','AAAA','P20_A');
    
    //2
    $f_DisableOnValue('P20_B','BBBB','P20_A');
    
    //3
    $f_DisableOnValue('P20_B','CCCC','P20_A');
    
    }
    

    If P20_B is "YYYY" //1 will disable P20_A, then because P20_B is "YYYY", //2 will allow to P20_A because P20_B! = "BBBB"etc etc...

    Try $x_disableItem:

    $x_disableItem('P20_A', (($v('P20_B') === 'AAAA') || ($v('P20_B') === 'BBBB') || ($v('P20_B') === 'CCCC')))
    
  • Which is the best way for a function called identify the class name of the appellant.

    Which is the best way for a function called identify the class name of the appellant.

    (1) sun.reflect.Reflection using the function call
                    Class caller = Reflection.getCallerClass(2);
                    System.out.println("Caller Class Name ::"+caller.getName());
    Trace of function called battery 2) analysis of current threads
                    StackTraceElement[] stElements=Thread.currentThread().getStackTrace();
                    System.out.println("Caller Class Name ::"+stElements[3].getClassName());
    Y at - it all the other ways to achieve the same. What is the best way?
    Called function does accept no argument, I don't want the arguments of function calling function called t.

    Help, please.

    With greetings
    Paul

    798185 wrote:
    Which is the best way for a function called identify the class name of the appellant.

    Y at - it all the other ways to achieve the same.

    SecurityManager

        // 0 is the anonymous SecurityManager class
        // 1 is this class (also works in static context)
        // 2 is calling class
        static Class getClass(int i) {
            return new SecurityManager() {
                protected Class[] getClassContext() {
                    return super.getClassContext();
                }
            }.getClassContext();} 
    
  • Store events in the various tables / AVG function error

    Hello

    I have a very newbie question that I can't solve.

    I want to store events in a database, well, but if I set the events on the context like this file:

    < wlevs:event - type-repository >
    < wlevs:event - type the type name 'Averages' = >
    < wlevs:properties >
    < name wlevs:property = "average_Generator1_ActivePower" type = "float" / >
    < name wlevs:property = "sum_Generator2_ActivePower" type = "int" / >
    < name wlevs:property = "max_Substation_Active_Power" type = "int" / >
    < name wlevs:property = "number_events" type = "int" / >
    < / wlevs:properties >
    < / wlevs:event - type >
    < wlevs:event - type the type name = "WindEvent" >
    < wlevs:properties >
    < name wlevs:property = "generator1_ActivePower" type = "int" / >
    < name wlevs:property = "generator2_ActivePower" type = "int" / >
    < name wlevs:property = "substation_Active_Power" type = "int" / >
    < / wlevs:properties >
    < / wlevs:event - type >
    < / wlevs:event - type-repository >

    They will be stored at the same table, TupleValues table.

    I'm trying to work around this situation by defining one of the events as a class, and in this case the CEP Oracle create another table to store the event. But with this Setup, I have an error on the processor node, more exactly, in the avg function that use a property of the created class. Below it is the context, the class of java and the query file in the processor

    Class #Java

    public class WindEvent {}

    private Generator1_ActivePower entire;
    private Generator1_AverageExpectedEnergy entire;
    private Generator2_ActivePower entire;
    private Generator2_AverageExpectedEnergy entire;
    private Substation_Active_Power entire;
    private Substation_AverageExpectedEnergy entire;


    file #context

    < wlevs:event - type-repository >
    < wlevs:event - type the type name = "WindEvent" >
    < wlevs: class > oracle.cep.demo.events.WindEvent < / wlevs: class >
    < / wlevs:event - type >
    < / wlevs:event - type-repository >

    < wlevs: adapt id = "adapter" provider = "csvgen" >
    < wlevs:listener ref = 'channel' / >
    < wlevs:instance - name of the property = 'port' value = "9001" / >
    < wlevs:instance - name of the property = "eventTypeName" value = "WindEvent" / >
    < wlevs:instance - name of the property = "eventPropertyNames."
    value = "generator1_ActivePower, generator1_AverageExpectedEnergy, generator2_ActivePower, generator2_AverageExpectedEnergy, substation_Active_Power, substation_AverageExpectedEnergy" / >

    < / wlevs: adjust >

    < wlevs: channel id = 'string' - type event = "WindEvent" >
    < wlevs:listener ref = "processor" / >
    < / wlevs: channel >

    < wlevs:processor id = "processor" >
    < / wlevs:processor >


    #query

    < processor >
    processor < name > < / name >
    < rules >
    < request id = "ExampleQuery" >
    <! [CDATA [select avg (substation_Active_Power) got max_Substation_Active_Power, count (*) as number_events of the channel [line 60]]] >
    < / query >
    < / rules >
    < / processor >

    If someone could help him in both questions, I'll be very grateful

    Keep your definition of class as -

    public class WindEvent {}

    private Generator1_ActivePower entire;
    private Generator1_AverageExpectedEnergy entire;
    private Generator2_ActivePower entire;
    private Generator2_AverageExpectedEnergy entire;
    private Substation_Active_Power entire;
    private Substation_AverageExpectedEnergy entire;

    }

    In other words, use integer instead of int.

    Then, change the query for-

    Select avg (* substation_Active_Power.intValue () *) as avg_Substation_Active_Power, count (*) as number_events of the channel [line 60]

  • How does the library function call Labview? Can I emulate using C++?

    Hi all. I recently finished writing a dll CUDA for LabView, and now I'm in the steps of optimization of code, memory management, etc. BUT since my code depends on the entries of Labview (lots of data under types of specific data as table manages and Clusters labview) I can't use the CUDA Profiler or the Profiler VC ++ on the DLL. What I intend to do runs labview and then out of all data entry for the DLL in a binary file and then add an additional function in my code that will read in the binary file, allocate and assign variables to their respective positions, and then call the specific DLL function in Labview. In the end, this miniature function will act as the library function call to my specific group of data entries.

    In any case, I started to make this purchase all my data entry of cluster and it comes out in a binary file. And then I started the initialization of the handles of labview, allocating memory and begins to write the binary data in the memory and it works for integers (ints), floats, etc., but I'm confused on how it works with table handles!

    Some examples of code:

    Sets the Handle for table 1 d for INT
    typedef struct {}
    int length;
    int val [1];
    to access the value in a row-online val [Online]
    } Array1dInt, * Array1dIntHandle;

    int main()
    {
    Array1dIntHandle x = new Array1dInt *;
    (* x) = new Array1dInt;

    ifstream file ('TESTDATAIN.dat', ios: in | ios::binary);

    If (file.is_open ())
    {
    file ((char *) &(*x)-> length, sizeof;)
    file ((char *) &(*x)-> val [0], sizeof (int) *(*x)-> length);

    LabviewSpecificFunction (x);
    leader. Close();
    } else
    {
    < "file="" did="" not="" open!"=""><>
    }
    return 0;
    }

    __declspec(dllexport) LabviewSpecificFunction (Array1dIntHandle x)
    {
    ...
    }

    However, my program crashes when the table is nominally big, and it is expected, because if we look at the Array1dHandle, it has allocated only enough memory to 1 item of value! YET, somehow, in its magical and mysterious labview is capable of making val [1] be val [HOWEVERMANYYOUWANT], even if C++ 101 says that val [1] is a constant pointer, and even if I dynamically allocated memory another somwhere, I would never be able to put these data in this round!

    Can you explain, or maybe even write example on how I can fool my program into thinking that the binary code comes from labview, so I can then run my program independent of allowing me to profile the functions inside labview?

    I hope that this question is clear and my sample code is also clear, but I'm happy to answer any questions that relate to this.

    Thank you all!

    I think that I thought about it.

    Array1dIntHandle x = new Array1dInt *;
    int tempsize;
    file ((char *) & tempsize, sizeof;)
    (* x) = (Array1dInt *) malloc (sizeof (int) + sizeof (int) * tempsize);
    (* x)-> length = tempsize;
    file ((char *) &(*x)-> val [0], sizeof (int) *(*x)-> length);

    Well enough, you will need to make the handle, and then make a new Array1dInt * for him, then read in the length of the array in a temporary variable. Then use this information to then malloc memoery quantity you need for the table and pass this place on the handle. Now the handle will point to the size of the memory and you will be able to access the memory in the format, you've done the handle. Badabing badaboom

  • Make sure that wire you all the inputs and outputs of your node library function call?

    This document says "make sure that wire you all the inputs and outputs of your node library function call.

    http://digital.NI.com/public.nsf/WebSearch/7253D2F0D91F68058625752F005AB672?OpenDocument&submitted&&...

    But all the terminals on the right side of the call library node considered "outputs" referred to in the foregoing statement?

    This same document continues to show the right way to allocate memory with this illustration and in the illustration, the right "outputs" are left without junctions.

    Am I right in assuming that the only terminals that count as outputs, those who use the code of the DLL (modify) as output?  If it is true, then all other terminals output associated with the values entered alone so don't really account as outputs, correct?

    In the parameter call-library configuration screen there is a "Constant" check box and the help that he wrote "indicates whether the parameter is a constant."  What is this box? for me in the setup of the DLL call

    Finally, assuming that a call from the DLL that is supposed to write in these five outputs, is it legitimate to use constants like this to book a space of memory for the output values?

    How about if local variables associated with the output terminals are used instead?

    Despite the linked document, it is necessary to connect the corresponding entry for simple scalar output parameters (for example a digital). LabVIEW automatically allocate memory for them. If you do not want the entries for all the output wire anyway, there should not be no difference between a constant and a local variable; I would use a constant to avoid useless local variables.

    For settings that are only entries, there is not need to connect the outlet side. It's a bit simplistic since all parameters are entered only and get one result (other than the return value), you pass a memory address and modify the content to this address, but LabVIEW manages this dereferencing pointer for you. If you want to really get into the details, learn more about pointers in C.

    The "Constant" check box acts as the qualifier "const" on a c function parameter. It tells the compiler that the function you are calling will not change this setting. If you call a function prototype includes a const parameter, then you must mark this as a constant parameter when you configure the call library function node. Otherwise, I wouldn't worry on this subject.

  • How to raise an event (in the structure of the event) comparison function output

    Hello

    I want to triger specific event from a structure of event with the release of the comparison function. I tried several times but the output of the comparison function is not triggered. Please, propose solutions.

    Kind regards

    Mlad

    If you want to use a structure of the event, you must react on the digital inputs, for example as follows:

    Notice that the VI is inactive unless a change control (x, y, stop), date on which Boolean values are updated, comparison made, his played if necessary, and VI stopped if you press stop.

  • How to use the node function call library for a function in the dll with the data SUB type

    Hi all

    I would ask for your kind help

    I am facing a problem with the call library node.

    I have a C++ (stdcall) function, which has Sub as data type

    XXXX error code (hwnd, lid, getValue, * Sub data1, * Sub data2)

    data1 and data2 types are constantly changing based on the value of 'getValue '.

    Mainly I can use the call library node several times and adapt each node according to the types of data data1, data2 and extract the values and use in the code. Here is no question. Real question is:

    My question:

    How can I use a node of library time call and make a case according to the 'getvalue', who will control the data1, data2 data type. Here I really seeking solutions.

    My tests:

    I used varaints as entry to the libray call node of the data1, data2 and selected parameters in the call libraby node as "Adapt to type. Here labview just crashed.

    I appreciate your suggestions to feedbackand.

    Thank you

    Karine

    You must allocate enough space for data1 and data2, and then pass a pointer to this space. An easy way to do this is the function to initialize table. Set the U8 type and size for the number of bytes required. Pass this array to the function as a pointer of table data.

    After the function call returns, you need to extract the data in the table. You can do it manually, but a simple approach is to use the array of bytes to a string. Then, in a housing structure, use Unflatten chain to convert the string to the correct data type. This method also converts the "endianness" which will be probably necessary; Be sure to only set all entries for unflatten correctly.

  • How to pass the value of an element in a function called by a procedure

    Hello

    I have a procedure named PROCEDURE AFFICHAGE_PLUVIO_VEILLE (sorry I don't know how to get in shape for the code):

    {code: sql}create or replace PROCEDURE AFFICHAGE_PLUVIO_VEILLE AS

    CURSOR curs1 is

    Select the site, name, site_pluviometre clef_var

    where EN_SERVICE = 'YES ';

    number of stmt;

    BEGIN

    DELETE FROM PLUVIO_DATA;

    for m loop curs1

    stmt: = calc_pluvio (m.clef_var);

    INSERT INTO pluvio_data values (m.clef_var, stmt);

    end loop;

    commit;

    END AFFICHAGE_PLUVIO_VEILLE; {code}

    This procedure calls a function:

    {code: sql}create or replace function "CALC_PLUVIO" (station NUMBER)

    return the number is the default number of 0 total.

    BEGIN

    WITH PRECIPITATION AS

    (SELECT DATE1 RAINFALLDATE, VALUE

    OF EVV_STPL

    WHERE CLEF_VAR = station

    AND TRUNC (DATE1) = TRUNC (sysdate-1))

    SELECT SUM (TOTO) INTO CUMULATION

    DE)

    SELECT TRUNC (RAINFALLDATE) AS date,

    VALUE,

    (VALUE) AHEAD OF (TRUNC PARTITION (RAINFALLDATE)

    ORDER BY RAINFALLDATE

    ) - VALUE AS TOTO

    PRECIPITATION

    )

    WHERE TOTO > = 0

    GROUP BY date;

    DATE OF RETURN;

    EXCEPTION

    WHEN NO_DATA_FOUND THEN

    TOTAL: = 0;

    DATE OF RETURN;

    END; {code}

    You can see that the function uses 'sysdate-1' regarding the date. " In order to be more flexible with the date and to be able to use a date other than the date of the previous day, I would like to pass as a parameter to the function of the value of a page called P1_DATE.

    But, how can I do? Function CALC_PLUVIO' is called by the stored procedure 'AFFICHAGE_PLUVIO_VEILLE of PROCEDURE' for which I can not transmit to any parameter as for example the P1_DATE element.

    I use Application Express 5.0.1.00.06

    Thank you for your help.

    Chipniz wrote:

    I have a procedure named AFFICHAGE_PLUVIO_VEILLE of PROCEDURE (sorry I don't know how to get in shape for the code):

    Click on the link to the editor advanced usage in the top right of the edit box, select the code in the editor and choose the language desired from the syntax highlighting options in > toolbar button menu. (For SQL and PL/SQL code, use "SQL").

    create or replace PROCEDURE AFFICHAGE_PLUVIO_VEILLE AS
      CURSOR curs1 is
        select site, nom, clef_var from site_pluviometre
                  where EN_SERVICE = 'OUI';
      stmt number;
    BEGIN
      DELETE FROM PLUVIO_DATA;
      for m in curs1 loop
        stmt := calc_pluvio (m.clef_var);
        INSERT INTO pluvio_data values (m.clef_var, stmt);
      end loop;
        commit;
    END AFFICHAGE_PLUVIO_VEILLE;
    

    This procedure calls a function:

    create or replace function "CALC_PLUVIO" (station in NUMBER)
    return number is cumul number default 0;
    BEGIN
    WITH RAINFALL AS
    (SELECT DATE1 RAINFALLDATE, VALEUR VALUE
    FROM    EVV_STPL
    WHERE  CLEF_VAR = station
    AND        TRUNC (DATE1) = TRUNC (sysdate-1))
    SELECT SUM (TOTO) INTO CUMUL
    FROM (
    SELECT TRUNC (RAINFALLDATE) AS datte,
    VALUE,
    LEAD (VALUE) OVER ( PARTITION BY TRUNC (RAINFALLDATE)
    ORDER BY RAINFALLDATE
    ) - VALUE AS TOTO
    FROM RAINFALL
    )
    WHERE TOTO >= 0
    GROUP BY datte;
    RETURN CUMUL;
    EXCEPTION
        WHEN NO_DATA_FOUND THEN
            CUMUL := 0;
        RETURN CUMUL;
    END;
    

    You can see that the function uses ' sysdate-1' regarding the date. " To be more flexible with the date and to be able to use a date other than the date of the previous day, I want to pass as a parameter to the function of the value of a page called P1_DATE.

    But, how can I do? The CALC_PLUVIO function ' is called by the stored procedure 'AFFICHAGE_PLUVIO_VEILLE of PROCEDURE' for which I can not transmit to any parameter as for example the P1_DATE element.

    What do you mean by "I can't pass any parameter"? That you cannot change the signatures of the procedure and function?

    Passage of a parameter is the recommended approach. Including a default value will ensure that programs are backward compatible with existing code that does not it:

    create or replace PROCEDURE AFFICHAGE_PLUVIO_VEILLE (p_rainfall_date in date default null) AS
      CURSOR curs1 is
        select site, nom, clef_var from site_pluviometre
                  where EN_SERVICE = 'OUI';
      stmt number;
    BEGIN
      DELETE FROM PLUVIO_DATA;
      for m in curs1 loop
        stmt := calc_pluvio (m.clef_var, p_rainfall_date);
        INSERT INTO pluvio_data values (m.clef_var, stmt);
      end loop;
        commit;
    END AFFICHAGE_PLUVIO_VEILLE;
    
    create or replace function "CALC_PLUVIO" (station in NUMBER, p_rainfall_date in date default null)
    return number is
      cumul number default 0;
      rainfall_date date;
    BEGIN
      rainfall_date := trunc(coalesce(p_rainfall_date, sysdate-1));
    WITH RAINFALL AS
    (SELECT DATE1 RAINFALLDATE, VALEUR VALUE
    FROM    EVV_STPL
    WHERE  CLEF_VAR = station
    AND        TRUNC (DATE1) = calc_pluvio.rainfall_date)
    SELECT SUM (TOTO) INTO CUMUL
    FROM (
    SELECT TRUNC (RAINFALLDATE) AS datte,
    VALUE,
    LEAD (VALUE) OVER ( PARTITION BY TRUNC (RAINFALLDATE)
    ORDER BY RAINFALLDATE
    ) - VALUE AS TOTO
    FROM RAINFALL
    )
    WHERE TOTO >= 0
    GROUP BY datte;
    RETURN CUMUL;
    EXCEPTION
        WHEN NO_DATA_FOUND THEN
            CUMUL := 0;
        RETURN CUMUL;
    END;
    

    This code can be called APEX by:

    AFFICHAGE_PLUVIO_VEILLE(p_rainfall_date => to_date(:p1_date, 'DD-MON-YYYY')); -- change format mask to that used in the P1_DATE item
    

    Moreover, if the P1_DATE element is the only possible source of another value on the date of the rain, then the value can be referenced directly in the function:

    create or replace function "CALC_PLUVIO" (station in NUMBER)
    return number is
      cumul number default 0;
      rainfall_date date;
    BEGIN
      rainfall_date := trunc(coalesce(v('P1_DATE'), sysdate-1));
    WITH RAINFALL AS
    (SELECT DATE1 RAINFALLDATE, VALEUR VALUE
    FROM    EVV_STPL
    WHERE  CLEF_VAR = station
    AND        TRUNC (DATE1) = calc_pluvio.rainfall_date)
    SELECT SUM (TOTO) INTO CUMUL
    FROM (
    SELECT TRUNC (RAINFALLDATE) AS datte,
    VALUE,
    LEAD (VALUE) OVER ( PARTITION BY TRUNC (RAINFALLDATE)
    ORDER BY RAINFALLDATE
    ) - VALUE AS TOTO
    FROM RAINFALL
    )
    WHERE TOTO >= 0
    GROUP BY datte;
    RETURN CUMUL;
    EXCEPTION
        WHEN NO_DATA_FOUND THEN
            CUMUL := 0;
        RETURN CUMUL;
    END;
    
  • How to call a function within a movieclip on the main timeline in CC animate canvas?

    Hello world...

    In AS3: Function (fnc name: myFunction) inside a Movieclip (mc1). I'll call you timeline mc1.myFunction ();

    But how to call AnimateCC canvas?

    If you have an instance of MovieClip named "mc" with the following code in to:

    This.Fun = function() {}

    Alert ("Hey!");

    }

    You can call this function (increased to 'this' within the MC) using the oon following the main timeline:

    var root = this;

    this.mc.addEventListener ("click", function() {}

    Console.log (root.mc.fun ());

    });

  • Transient attribute based on the selected query by using a function call

    Hello

    Post version is 11.1.1.7.0 JDeveloper.

    I'm not able to get the following work properly;

    1. I have a scenario header / detail.
    2. Calculate a value for each row returned detail that I find. This calculation is done using an existing database to function.
    3. The function requires 3 input parameters.
    4. Two of these parameters can be retrieved in the detail row and one is a value which is on the header.
    5. I created a transient attribute on the object of the detail view and selected the following properties of the 2 attribute;
      1. Mapped to the column or SQL
      2. Selected in SQL
    6. I entered the following SQL Expression;
      1. function_name (DetailTableAlias.value1, DetailTableAlias.value2, ViewLinkName.value3)
    7. Running AOS that contains the objects of view header / detail, I encounter a SQL error which indicates that ViewLinkName.value3 is an invalid identifier.
      1. I can understand why this error occurs.
    8. If I change the ViewLinkName.value3 to a literal value, the error will not occur.

    So, my question is how can I pass the third parameter to the transitional attribute database function call as the value literal and not as a reference to one, missing attachments header table, column?

    Concerning

    Leon.

    Hi Leon

    Have you explored solve this by an inline SQL query to derive the 3rd parameter of the function? In other words, the problem in SQL instead of ADF.

    DMI

Maybe you are looking for

  • Need your opinion on Satellite P200D

    Hello I'm just registered on this forum that I am buying a new laptop computer and have never owned a Toshiba. I looked at the Satellite P 200 d and would like to receive comments, that I also learn to consider another non-Toshiba product. What are t

  • SPDIF

    I have hp Pavilion dv6607nr with windows vista home. Spdif output is available on this model?  If so, how should I connect my laptop to the audio/video receiver via optical cable? PL. guide me, I'm a bit new to computers. you will appreciate your hel

  • iPhone requesting the password for the fingerprint ID.

    Randomly, my phone asking my access code not be used within 48 hours. However, I used it frequently in the 48 hours before. The last time that I had the problem, I contacted the support who suggested I wipe my phone and re-install/restore backup. I d

  • time data between extraction using the database

    Hello I do datalogging with data 1 min interval, the logg data upward at 3 days, was preparing I use sql server, now I can't able to insert and extract data also plenty fast.  but I need to recover the data in the time specified and also a lot of wis

  • Download MS clenup tool error

    I tried to download the MS cleanup to clen Cyberlink PowerDirector files tool, but has had a Permission denied error, code a 800, 0046, Source Microsoft VBscript runtime error. I have Windows 7 OS.Please help with this errorThank youOlcam