How to call the function 5 times

hi
i have a function 'a'  with array 1x2, 1x3, 1x4...
every step its 1x2 > answer
1x3 > answer..
ans so on
if answer correct i call my function 'a' again.
how i can call my function 'a' just 3 times?
thank you.

Hello!
Well, it depends on some factors, like:
1) Function 'a' itself checks if the answer is correct?
2) Which event calls function 'a'?
... and so on.
Please, if you could detail your problem and maybe post some code, it will be easier for us to understand it and help you :-).
Message was edited by: rah02

Similar Messages

  • How to call the function before web application close

    How we can call a flex function before closing the browser in web application

    hello
    this link may help you  http://cookbooks.adobe.com/post_Close_event_of_browser_or_browser_tab-18211.html.
                         Gajanan Hiroji | [email protected] | www.isacglobal.com

  • How to call oracle function from ejb3

    i'm trying to call an oracle query-function from ejb3.
    The oracle function:
    create or replace FUNCTION getSecThreadCount(secId in NUMBER,avai in NUMBER)
    RETURN SYS_REFCURSOR is cur SYS_REFCURSOR;
    m_sql VARCHAR2(250);
    BEGIN
    m_sql:='select count(thrId) from thread where secId='|| secid||'
    and thrAvai='|| avai;
    open cur for m_sql;
    return cur;
    END;
    I'v tried several ways to call it,but all failed:
    1. the calling code:
    public Object getSectionThreadCount(int secId,int avai){
              Query query=manager.createNativeQuery("{call getSecThreadCount(?,?) }");     
              query.setParameter(1, secId);
              query.setParameter(2, avai);
              return query.getSingleResult();
    but i got the exception:
    Exception in thread "main" javax.ejb.EJBException: javax.persistence.PersistenceException: org.hibernate.exception.SQLGrammarException: could not execute query; nested exception is: javax.persistence.PersistenceException: org.hibernate.exception.SQLGrammarException: could not execute query
    javax.persistence.PersistenceException: org.hibernate.exception.SQLGrammarException: could not execute query
    Caused by: java.sql.SQLException: ORA-06550: row 1, col 7:
    PLS-00221: 'GETSECTHREADCOUNT' not procedure or not defined
    ORA-06550: row 1, col 7:
    PL/SQL: Statement ignored
    2. the calling code:
    @SqlResultSetMapping(name = "getSecThreadCount_Mapping")
    @NamedNativeQuery(name = "getSecThreadCount",
    query = "{?=call getSecThreadCount(:secId,:avai)}",
    resultSetMapping = "getSecThreadCount_Mapping",
    hints = {@QueryHint(name = "org.hibernate.callable", value = "true"),
              @QueryHint(name = "org.hibernate.readOnly", value = "true")})
    public Object getSectionThreadCount(int secId,int avai){
              Query query=manager.createNamedQuery("getSecThreadCount");     
              query.setParameter("secId", secId);
              query.setParameter("avai", avai);
              return query.getSingleResult();
    but i run into the exception:
    Exception in thread "main" javax.ejb.EJBException: javax.persistence.PersistenceException: org.hibernate.exception.SQLGrammarException: could not execute query; nested exception is: javax.persistence.PersistenceException: org.hibernate.exception.SQLGrammarException: could not execute query
    javax.persistence.PersistenceException: org.hibernate.exception.SQLGrammarException: could not execute query
    Caused by: java.sql.SQLException: lost in index IN or OUT parameter:: 3
    By the way, i have successfully called the function from hibernate. And i use oracle 11g, JBoss5 RC1.
    Could anyone tell me how to call the function from EJB3?
    Thanks.

    Here's a working model:
    package.procedure: (created in example schema scott)
    CREATE OR REPLACE package  body data_pkg as
      type c_refcursor is ref cursor;
      -- function that return all emps of a certain dept
      function getEmployees ( p_deptId in number
      return c_refcursor
      is
        l_refcursor c_refcursor;
      begin
         open l_refcursor
        for
              select e.empno as emp_id
              ,        e.ename as emp_name
              ,        e.job   as emp_job
              ,        e.hiredate as emp_hiredate
              from   emp e
              where  e.DEPTNO = p_deptId;
        return l_refcursor;
      end getEmployees;
    end data_pkg;
    /entity class:
    package net.app.entity;
    import java.io.Serializable;
    import java.util.Date;
    import javax.persistence.Column;
    import javax.persistence.Entity;
    import javax.persistence.GeneratedValue;
    import javax.persistence.GenerationType;
    import javax.persistence.Id;
    import javax.persistence.NamedNativeQuery;
    import javax.persistence.QueryHint;
    import javax.persistence.SequenceGenerator;
    import javax.persistence.Table;
    @SuppressWarnings("serial")
    @Entity
    @Table (name="emp")
    @SequenceGenerator(name = "EmployeeSequence", sequenceName = "emp_seq")
    @NamedNativeQuery( name = "getEmpsByDeptId"
                   , query = "{ ? = call data_pkg.getEmployees(?)}"
                   , resultClass = Employee.class
                   , hints = { @QueryHint(name = "org.hibernate.callable", value = "true")
                          , @QueryHint(name = "org.hibernate.readOnly", value = "true")
    public class Employee implements Serializable
        @Id
        @Column(name="emp_id")
        @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "EmployeeSequence")
        private int id;
        @Column(name="emp_name")
        private String name;
        @Column(name="emp_job")
        private String job;
        @Column(name="emp_hiredate")
        private Date hiredate;
        // constructor
        public Employee (){}
        // getters and setters
        public int getId()
         return id;
    etc...session bean:
    package net.app.entity;
    import java.util.ArrayList;
    import java.util.List;
    import javax.ejb.Stateless;
    import javax.persistence.EntityManager;
    import javax.persistence.PersistenceContext;
    import javax.persistence.Query;
    import net.app.entity.Employee;
    import net.app.iface.ScottAdmin;
    @Stateless
    public class ScottAdminImpl implements ScottAdmin
        @PersistenceContext
        private EntityManager entityManager;
        @SuppressWarnings("unchecked")
        public List<Employee> getEmployeesByDeptId(int deptId)
         ArrayList<Employee> empList;
         try
             Query query = entityManager.createNamedQuery("getEmpsByDeptId");
             query.setParameter(1, deptId);
             empList = (ArrayList<Employee>) query.getResultList();
             return empList;
         catch (Exception e)
             e.printStackTrace(System.out);
             return null;
    }client:
    package net.app.client;
    import java.util.List;
    import javax.naming.InitialContext;
    import javax.naming.NamingException;
    import net.app.entity.Employee;
    import net.app.iface.ScottAdmin;
    public class ScottClient
        public static void main(String[] args)
         try
             // create local interface
             InitialContext ctx = new InitialContext();
             ScottAdmin adminInterface = (ScottAdmin) ctx.lookup("ScottAdminImpl/remote");
             // select employees by deptno
             int deptno = 20;
             List<Employee> empList = adminInterface.getEmployeesByDeptId(deptno);
             // output
             System.out.println("Listing employees:");
             for (Employee emp : empList)
              System.out.println(emp.getId() + ": " + emp.getName() + ", " + emp.getJob() + ", " + emp.getHiredate());
         catch (NamingException e)
             e.printStackTrace(System.out);
    }Basically you just ignore the refcursor outbound parameter.
    This is a stored function, have yet to try outbound refcursor parameters in stored procedures...
    Edited by: _Locutus on Apr 2, 2009 2:37 PM                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • Call the function in postgresql to jsp

    again i'm a newbie of jsp.. i just wanna know how to call the function in postgresql to jsp.. how to code it?... thanks in advance

    <%@ page contentType="text/html;charset=windows-1252" import="java.sql.*"%>
    <%
    try
      Class.forName("org.postgresql.Driver").newInstance();
      Connection con = DriverManager.getConnection("jdbc:postgresql://localhost:5432/TESTDB","postgres","");
      Statement stmt = con.createStatement();
      ResultSet rs = stmt.executeQuery("select catalog('catalog1') from catalog");
    %>
    <html>
      <head>
        <meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
        <title>untitled</title>
      </head>
      <body>
        <%
        while(rs.next()){
          out.println(rs.getString(1)+"<br>");
        %>
      </body>
    </html>
    <%
    }catch (Exception ex)
      ex.printStackTrace();
    %>
    CREATE or Replace FUNCTION catalog(varchar) RETURNS catalog
        AS $$ SELECT title FROM catalog WHERE catalogid = $1 $$
        LANGUAGE SQL;
    CREATE TABLE catalog
      catalogid varchar(25) NOT NULL,
      journal varchar(25),
      publisher varchar(25),
      edition varchar(25),
      title varchar(45),
      author varchar(25),
      CONSTRAINT catalog_pkey PRIMARY KEY (catalogid)
    WITH OIDS;

  • How to call the Report program into Function module

    Hi Experts,
    Actually I want to create the DataSource. But I have only the ALV report program. I need to create function module but I don’t know how to call the ALV report program using in function module  
    So could you please any one send the Document or step by step method?
    Advance Thanks,
    Sathis

    If the report is just based out of a table than create a Generic Extractor using View.
    If its an InfoSet query than create a Generic Extractor on that InfoSet.
    If its an ABAP report than create a Generic Extractor using FM
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/a0f46157-e1c4-2910-27aa-e3f4a9c8df33

  • How to call the Application configuration in run time.

    hi guru,
    i have created two  Application configuraton   and it working fine.
    my question how to call the application configuration in run time.
    Example :
    Based on the user i want to change the Application Configuration.like Super user and Normal user.
    Advance thank's
    Regard's
    Vivekanathan.S

    Hi,
    Please try out this way-
    Have a look at this table -
    WDY_CONF_APPLU - (Customizing Data for Web Dynpro Applications).
    after you are done with the configuration--
    Ge the config id for the given application from this table. And depending on the user get an entry from this table and display accordingly.
    Please refer to these links -
    different default layouts for different CONFIG_IDs
    Get WDCONFIGURATIONID
    Regards
    Lekha

  • How to call the secured EJB from timer ejb timedout method.

    Hi All,
    I have a couple of questions on EJB 3.1 Timer Service.
    1. How to call the secured EJB (annotated @RolesAllowed) from Timer EJB @Timeout Method?
    2. What's the default role/principal with which the Timer @Timeout Method gets called?
    Please let me know any info regarding the same.
    Thanks,
    Suresh

    I'd start here:
    http://ant.apache.org/manual/index.html
    If that doesn't help, go to the table of contents and start poking around. You don't need to read the whole thing front to back, but if you're not willing to spend some time researching and reading, you're not going to get very far.

  • How to call the integration engine not the remote function.

    Hi!
    I want to get the data from the client 000 with an rfc call through the xi (client 001). But when I call the function via rfc, the funciton is executed in the client 001, instead of forwarding the call to the integration engine.
    How can I forwarded to the engine this call?
    I only made a sender communication channel in the DI which is an sener adapter type RFC.

    Thanks for the reply.
    But I have no receiver channel yet. so i can't even reach any server if my call would be catched by the intergration engine.
    But unfortunately I can reach the target system without the engine.
    I use java connector to connect the external system to my intergration server.
    Please help.

  • How to see the Ringing Time of a Missed Call?

    How to see the Ringing Time of a Missed Call?

    I wanna see the missed call as a Genuine Call (Ringing for the full time) or a mere signal of a few second as a request for call back.

  • How to call a function in the background in WDA?

    __The requirement is__
    call the function XYZ from Webdynpro ABAP program to run in the background and user doesn’t have to wait to finish it, but can work on other screens/transactions.
    1. Should function XYZ be remote-enabled?
    2. Will CALL function XYZ in background task work?
    Points will be rewarded. Thanks.

    Hi John,
    I guess you will have to use the asynchronous RFC for your requirement.
    So that this FM can be called frm WD applicaiotn and due to asynchronous nature, it has no relation with other user actions which are going on .
    You can check this
    [help|http://help.sap.com/saphelp_nw04/helpdata/en/22/04259f488911d189490000e829fbbd/content.htm]
    Hope that helps.
    regds,
    Akshay
    Edited by: Akshay Bhagwat on Feb 6, 2008 2:25 PM

  • How to identify which switch in the panel called the function?

    here i have some 192 switches and 192 leds corresponding to each switch,
    if a switch is on(say 10th) correspondingly led(10th) should glow.
    i want to use the same function for all switche led pairs.
    all i could do was to check for the on switch in a for loop and then set the particular led on, but i find it very inefficient way of doing it.
    int CVICALLBACK switchOnOff (int panel, int control, int event,
    void *callbackData, int eventData1, int eventData2) is the function.
    can i use any of these arguments to extract which switch(unique id for that switch) called the function so that i can switch corresponding led glow?
    Solved!
    Go to Solution.

    Looping through controls is indeed a inefficient way of doing what you want!
    With such a great number of controls, you could assign an appropriate callbackData to each of them when loading the panel. Next you could create an array of control IDs with all the LEDs and operate in the switch callback to turn on and off the corresponding led. A small example will be more clear:
    At panel load:
    int leds[200];
    SetCtrlAttribute (panelHandle, PANEL_SWITCH1, ATTR_CALLBACK_DATA, (void *)1); leds[1] = PANEL_LED1;
    SetCtrlAttribute (panelHandle, PANEL_SWITCH2, ATTR_CALLBACK_DATA, (void *)2); leds[2] = PANEL_LED2;
    SetCtrlAttribute (panelHandle, PANEL_SWITCH192, ATTR_CALLBACK_DATA, (void *)192); leds[192] = PANEL_LED192;
    In the switch callback:
    int CVICALLBACK switchOnOff (int panel, int control, int event,
    void *callbackData, int eventData1, int eventData2)
    int sts;
    if (event != EVENT_COMMIT) return 0;
    // Get the status of the switch
    GetCtrlVal (panel, control, &sts);
    // Set the led to the proper status
    SetCtrlVal (panel, leds[(int)callbackData], sts);
    return 0;
    For this solution to work, leds[] array must be global so that it is available to the control callback.
    An additional improvement could be to modify the panel loading so that swithces and leds are created programmatically. You could have a single switch/led pair set in the UIR editor and next have a loop that duplicate the controls, sets callbackData and loads the array of led ids.
    Proud to use LW/CVI from 3.1 on.
    My contributions to the Developer Zone Community
    If I have helped you, why not giving me a kudos?

  • How to call a function module dynamically?

    Hi
    I am doing a smartform development and here my scenario.
    <b>Scenario:</b>
    There will be a simple report which will trigger a smartform output. The report has a selection screen and and in one of the field the user will enter the layout name or the layout name will be stored in the variant so that the user need not remember the layout name.
    Based on the layout selected i need to show the output.
    <b>What i have coded:</b>
    In my program after selecting the data i am calling the FM SSF_FUNCTION_MODULE_NAME which will return the function module name to be called.
    <b>Question:</b>
    How do i call the function module dynamically. I cannot do a single call to the function module using the FM name derived from the above function call. I want to make the interface calling dynamic. We dont want to hardcode the function calls coz we may have many layouts to be called so how is it possible in SAP to call the FM interface dynamically.
    ~Suresh

    Actually you can call the FM dynamically in by taking it into one variable and than use the CALL FUNCTION V_FM_NAME.
    But the problem here is, you need to take care about the importing, exporting and tables parameters. They needs to be same for all FMs which you are planning to call. Otherwise system will give you a run time error.
       CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
             EXPORTING  FORMNAME           = LF_FORMNAME
    *                 variant            = ' '
    *                 direct_call        = ' '
             IMPORTING  FM_NAME            = LF_FM_NAME
             EXCEPTIONS NO_FORM            = 1
                        NO_FUNCTION_MODULE = 2
                        OTHERS             = 3.
          CALL FUNCTION LF_FM_NAME
               EXPORTING
                          ARCHIVE_INDEX        = TOA_DARA
                          ARCHIVE_PARAMETERS   = ARC_PARAMS
                          CONTROL_PARAMETERS   = LS_CONTROL_PARAM
    *                 mail_appl_obj        =
    *                     mail_recipient       = ls_recipient
                          MAIL_SENDER          = LS_SENDER
    Regards,
    Naimesh Patel

  • How to call a function every 45 minutes?

    Hi..
    How to call a function after 45 minutes evry day..
    That function returns a value.
    Which is best? Thread or using timestamp?
    Regards

    Hello Joe,
    I heard of this website, gurgle something, that actually let's you put in words like "java" and "scheduling" and it will spit out other websites that mention these terms. Fascinating stuff, hopefully I'll find the time to test it someday soon..
    Lucky for you I have an article discussing solutions to your problem in my bookmarks:
    http://www.ibm.com/developerworks/web/library/j-schedule.html
    With kind regards
    Ben

  • How to synchronize the FieldPoint time with my computer time?

    When I using MAX to read the values from my FieldPoint cFP-1804 module, there is and timestamp generated for every measurement, but it does not match my PC's system time. How to synchronize the FieldPoint time with my windows PC?
    I found a thread on the forum regarding this problem (http://digital.ni.com/public.nsf/allkb/C4E56AD6450FC5FD86256DFF0007FF01), it ask me to select the Time Zone on the System Setting tab, but I didn't find any System Setting tab and Time Zone setting in my MAX screen. (MAX version4.4)
    I'm using the cFP-1804 without embedded CPU module, I'm using asp.net, measurement studio to link with the cFP-1804, not by using Labview. Does cFP-1804 have a Time Server function? Please tell me how to match the FieldPoint time with my PC. 
    Thanks

    Hi Presario2100,
    In order to obtain an updated timestamp with each FieldPoint Read, you should
    use a Flat Sequence structure.  In the same frame as the
    FieldPoint Read, use a Get Date/Time In
    Seconds node.
    The program obtains a fresh Timestamp each time the FieldPoint Read VI is
    called.
    I hope this helps.
    Message Edited by Pie56694 on 08-15-2008 05:58 PM
    Attachments:
    TSUpdates.jpg ‏38 KB
    FlatSequence.jpg ‏54 KB

  • /How to call a function in another PowerShell script

    Hi All,
    I want to use dot-sourced method to call the function from other script,While calling Function.ps1 from the second script there is a Null value in the beginning,
    How can we ignore this null value or there is a better approach of doing it without using Import-Module.
    #=======Function.ps1============
    function add($x,$y)
    $z=$x+$y
    Write-Host "The value is $Z"
    add $a $b
    #===========End==================
    The second script which has been dot-source to call the function
    #================Main script==========
    . C:\Users\Anirban\Desktop\Tester.ps1 |Out-Null
    add 1 2
    #================================
    Regards,
    Anirban Singha

    Dot Sourcing is adding the function ADD to console environment and the script is acting like a module vs a script with parameters.
    The Add $a $b line should be removed. (Where are $a and $b defined?)
    They are not defined hence, "The Value is " blank line
    #=======Function.ps1============
    function add($x,$y)
    $z=$x+$y
    Write-Host "The value is $Z"
    add $a $b
    Should be
    #=======Function.ps1============
    function add($x,$y)
    $z=$x+$y
    Write-Host "The value is $Z"
    PS C:\Test> . c:\tester.ps1
    Add 1 2
    Add 3 4
    The value is 3
    The value is 7
    However the add can work without dot sourcing the script file by parameterizing the script
    #=======Function.ps1============
    Param ($a,$b) # Parameters to the script
    function add($x,$y)
    $z=$x+$y
    Write-Host "The value is $Z"
    Add $a $b # body of script
    PS C:\Test> 
    C:\Tester.ps1 1 2
    C:\Tester.ps1 3 4
    The value is 3
    The value is 7

Maybe you are looking for

  • Installation  failed on Windows XP Home Edition

    Hi, I tried to download Oracle 9i Enterprise Edition on Windows XP Home edition. After 15% installation was over , it prompted me for Disk2 and I gave the path c:\dirName\Disk2..where the disk2 is located.But the prompt dialog keeps on asking about D

  • How do I link to a table from a slice of a pie chart?

    My project manager is after me to add a feature to a pie chart built on one of my tables. The code that selects from the table for the pie chart is this: select 'http://apexdevapp1.ci.raleigh.nc.us:7777',activity_type,count(ID) total FROM eba_ver2_cu

  • Bank_account_id in ap_checks_all table in R12

    All, I have a requirement to fetch details from 'ap_bank_accounts_all' and 'ap_checks_all' tables. Till 11i, the field 'bank_account_id' acts as a relation key between these two tables. In R12, the Etrm says the same field is 'No longer used' in 'ap_

  • Improvements for IWork  for iOS

    I write to suggest improving your IWork  for ios application. The applications are very good, but lacks some important features that would help iPad -Iphone users to work better. These absences are:  NUMBERS: - filters  - sort by more criteria  - cat

  • Malformed PDF

    Hello All, We generate PDFs from .Net 2.0 executable using Crystal Reports DLLs version 10.5.3700. The documents come out of PDF version 1.2 and are viewable with most any Adobe Readers. However, once opened in Adobe Acrobat 7.0 Professional and atte