How to calculate elapsed time based on user input

I'm not sure what to do next in this program. Basically, I'm not sure exactly how to get the time to output accurately, as in what forumla I should be using.
This is the question:
What comes 13 hours after 4 o'clock? Create an ElaspedTimeCalculator application that prompts the user for a starting hour, whether it is am or pm, and the number of elapsed hours. The application then displays the time after that many hours have passed. Application output should look similar to:
Enter the starting hour: 7
Enter am or pm: pm
Enter the number of elapsed hours: 10
The time is: 5:00 amHere's the code I have so far:
import java.util.Scanner;
public class ElapsedTimeCalculator
     public static void main(String[] args)
          int starting_hour;
          int starting_minutes; /*This is added in case the user wants to add minutes as well.*/
          String am_or_pm;
          int elapsed_hours;
          int elasped_minutes;
          int time_hours;
          int time_minutes;
          System.out.println("Welcome. This application will give you the time based on your input.");
          System.out.println(" ");
          Scanner input = new Scanner(System.in);
          System.out.print("Enter the starting hour: ");
          starting_hour = input.nextDouble();
          System.out.print("Enter the starting minutes: ");
          starting_minutes = input.nextDouble();
          System.out.print("Enter either 'am' or pm': ");
          am_or_pm = input.nextString();
          System.out.print("Enter the number of elapsed hours: ");
          elapsed_hours = input.nextDouble();
          input.close();
          time_hours =
          time_minutes = 
          if(am_or_pm = "am" || am_or_pm = "a.m." || am_or_pm = "AM" || am_or_pm = "A.M.")
               System.out.println("The time is " + time_hours + ":" + time_minutes + "am");
          if(am_or_pm = "pm" || am_or_pm = "p.m." || am_or_pm = "PM" || am_or_pm = "P.M.")
               System.out.println("The time is " + time_hours + ":" + time_minutes + "pm");
}To calculate time_hours should I just calculate this by adding the elapsed hour to the starting hour? I doubt it will be accurate for all situations.
Same for the time_minutes For example, if the starting minutes and the elapsed minutes were 50, it would be greater than 60. Also, not sure if it makes sense to separate hours and minutes like this, it's not required to in the question. I initally thought it would be easier to approach like this instead of allowing the user to input a double for the starting hour. ex. 5.7
I get the feeling that this is extremely simple, but nonetheless, I'm stuck, so any help would be appreciated.

Well thanks to both of you. I did a little reading up on the modulus operator and coupled it with some logic (although, truthfully, I'm not really using to there actually being an application for the remainder of a division operation, since it's never really used very much in any of my Math courses) and the hours portion works perfectly now:
import java.util.Scanner;
public class ElapsedTimeCalculator
     public static void main(String[] args)
          int starting_hour;
          //int starting_minutes; /*This is added in case the user wants to add minutes as well.*/
          String am_or_pm;
          int elapsed_hours;
          //int elasped_minutes;
          System.out.println("Welcome. This application will give you the time based on your input.");
          System.out.println(" ");
          Scanner input = new Scanner(System.in);
          System.out.print("Enter the starting hour: ");
          starting_hour = input.nextInt();
          //System.out.print("Enter the starting minutes: ");
          //starting_minutes = input.nextInt();
          System.out.print("Enter either 'am' or pm': ");
          am_or_pm = input.next();
          System.out.print("Enter the number of elapsed hours: ");
          elapsed_hours = input.nextInt();
          input.close();
          int time_hours = 0;
          //int time_minutes;
          String meridien;
          if(am_or_pm.equals("am"))
               time_hours = (starting_hour + elapsed_hours) % 24;
               //time_minutes = (starting_minutes + elapsed_minutes) % 60;
          else if(am_or_pm.equals("am"))
               time_hours = (starting_hour + elapsed_hours) % 24;
               //time_minutes = (starting_minutes + elapsed_minutes) % 60;
          else if(am_or_pm.equals("AM"))
               time_hours = (starting_hour + elapsed_hours) % 24;
               //time_minutes = (starting_minutes + elapsed_minutes) % 60;
          else if(am_or_pm.equals("A.M."))
               time_hours = (starting_hour + elapsed_hours) % 24;
               //time_minutes = (starting_minutes + elapsed_minutes) % 60;
          else if(am_or_pm.equals("pm"))
               time_hours = (starting_hour + elapsed_hours + 12) % 24;
               //time_minutes = (starting_minutes + elapsed_minutes) % 60;
          else if(am_or_pm.equals("p.m."))
               time_hours = (starting_hour + elapsed_hours + 12) % 24;
               //time_minutes = (starting_minutes + elapsed_minutes) % 60;
          else if(am_or_pm.equals("PM"))
               time_hours = (starting_hour + elapsed_hours + 12) % 24;
               //time_minutes = (starting_minutes + elapsed_minutes) % 60;
          else if(am_or_pm.equals("P.M."))
               time_hours = (starting_hour + elapsed_hours + 12) % 24;
               //time_minutes = (starting_minutes + elapsed_minutes) % 60;
          if(time_hours < 12)
               meridien = "A.M.";
               System.out.println("The time is: " + time_hours + ":00 " + meridien);
          else if(time_hours > 12)
               meridien = "P.M.";
               System.out.println("The time is: " + time_hours + ":00 " + meridien);
}Now the only thing is the minutes. My teacher did say she wants the user to have the option to input minutes also if he/she desires, so I do need it. However, the only problem is that if say the user inputs a "starting minute" of 14 for example, and 66 minutes elapsing, then (14 + 66) int/ 60 = 1r20 but using the modulus operator would only give me 20. So how will I be able to add any extra hours if it is necessary?

Similar Messages

  • How to add column dynamically based on user input in oracle?

    **how to add column dynamically based on user input in oracle?**
    I am generating monthly report based on from_date to to_date below is my requirement sample table
    EMPLOYEE_CODE| Name | CL_TAKEN_DATE | CL_BALANCE | 01-OCT-12 | 02-OCT-12 | 03-OCT-12
    100001.............John...........02-OCT-12...............6
    100002.............chris...........01-OCT-12...............4
    Based on user input, that is, if user need the report from 01-OCT-12 TO 03-OCT-12, i need to add that dates as column in my table, like 01-OCT-12 | 02-OCT-12 | 03-OCT-12....
    below is my code
    create or replace
    procedure MONTHLY_LVE_NEW_REPORT_demo
    L_BUSINESS_UNIT IN SSHRMS_LEAVE_REQUEST_TRN.BUSINESS_UNIT%TYPE,
    --L_LEAVE_TYPE_CODE           IN SSHRMS_LEAVE_REQUEST_TRN.LEAVE_TYPE_CODE%TYPE,
    L_DEPARTMENT_CODE IN VARCHAR2,
    --L_MONTH                    IN SSHRMS_LEAVE_REQUEST_TRN.LVE_FROM_DATE%TYPE,
    L_FROM_DATE IN SSHRMS_LEAVE_REQUEST_TRN.LVE_FROM_DATE%TYPE,
    L_TO_DATE in SSHRMS_LEAVE_REQUEST_TRN.LVE_TO_DATE%type,
    MONTHRPT_CURSOR OUT SYS_REFCURSOR
    AS
    O_MONTHRPT_CURSOR_RPT clob;
    v_return_msg clob;
    BEGIN
    IF (L_BUSINESS_UNIT IS NOT NULL
    AND L_FROM_DATE IS NOT NULL
    and L_TO_DATE is not null
    -- AND L_DEPARTMENT_CODE IS NOT NULL
    THEN
    OPEN MONTHRPT_CURSOR FOR
    select EMPLOYEE_CODE, EMPLOYEE_NAME AS NAME, DEPARTMENT_CODE AS DEPARTMENT,DEPARTMENT_DESC, CREATED_DATE,
    NVL(WM_CONCAT(CL_RANGE),'') as CL_TAKEN_DATE,
    case when NVL(SUM(CL2),0)<0 then 0 else (NVL(SUM(CL2),0)) end as CL_BALANCE,
    from
    SELECT DISTINCT a.employee_code,
    a.EMPLOYEE_FIRST_NAME || ' ' || a.EMPLOYEE_LAST_NAME as EMPLOYEE_NAME,
    a.DEPARTMENT_CODE,
    a.DEPARTMENT_DESC,
    B.LEAVE_TYPE_CODE,
    B.LVE_UNITS_APPLIED,
    B.CREATED_DATE as CREATED_DATE,
    DECODE(b.leave_type_code,'CL',SSHRMS_LVE_BUSINESSDAY(L_BUSINESS_UNIT,to_char(b.lve_from_date,'mm/dd/yyyy'), to_char(b.lve_to_date,'mm/dd/yyyy'))) CL_RANGE,
    DECODE(B.LEAVE_TYPE_CODE,'CL',B.LVE_UNITS_APPLIED)CL1,
    b.status
    from SSHRMS_EMPLOYEE_DATA a
    join
    SSHRMS_LEAVE_BALANCE C
    on a.EMPLOYEE_CODE = C.EMPLOYEE_CODE
    and C.STATUS = 'Y'
    left join
    SSHRMS_LEAVE_REQUEST_TRN B
    on
    B.EMPLOYEE_CODE=C.EMPLOYEE_CODE
    and c.EMPLOYEE_CODE = b.EMPLOYEE_CODE
    and B.LEAVE_TYPE_CODE = C.LEAVE_TYPE_CODE
    and B.STATUS in ('A','P','C')
    and (B.LVE_FROM_DATE >= TO_DATE(L_FROM_DATE, 'DD/MON/RRRR')
    and B.LVE_TO_DATE <= TO_DATE(L_TO_DATE, 'DD/MON/RRRR'))
    join
    SSHRMS_LEAVE_REQUEST_TRN D
    on a.EMPLOYEE_CODE = D.EMPLOYEE_CODE
    and D.LEAVE_TYPE_CODE in ('CL')
    AND D.LEAVE_TYPE_CODE IS NOT NULL
    group by EMPLOYEE_CODE, EMPLOYEE_NAME, DEPARTMENT_CODE, DEPARTMENT_DESC, CREATED_DATE
    else
    v_return_msg:='Field should not be empty';
    end if;
    END;
    my code actual output
    EMPLOYEE_CODE| Name | CL_TAKEN_DATE | CL_BALANCE
    100001....................John............02-OCT-12.................6
    100001....................chris...........01-OCT-12.................4
    how to add column dynamically based on from_date to to_date?
    Thanks and Regards,
    Chris Jerome.

    You cannot add columns dynamically. But you can define a maximum number of numbers and then hide unused columns in your form useing SET_ITEM_PROPERTY(..,VISIBLE, PROPERTY_FALSE);

  • How to calculate elapsed time(including time and date)?

    Hi all,
    I want to realize a function that can calculate the elapsed time which include time and date.Below is my thought:get the current time and date and store it to a .txt file then using the latest time and date subtract the time and date stored in the .txt file.how can realize it using the simplest way?I'm using LV7.1.

    Hi Idragon,
    you can do it like this.
    Mike
    Attachments:
    DateTime.PNG ‏12 KB

  • How to hide/display chart based on User input parameter

    hi,
    I have a chart in WEBI report. This report prompts the end user with values {Yes, No}.
    If user selects value 'Yes', Chart should be displayed
    If user selects value 'No', Chart should be hidden.
    Please let me know how to achieve this....
    Thanks,
    Vamsee

    You can use a combination of steps. First, create a filter for the chart block based on your input prompt value. If the user says "No" then the chart should be empty due to the filter. Next, there is a checkbox that tells Web Intelligence whether to show an empty block or not. It is on by default, you can turn it off.
    I detail a solution with similar results on my blog where only one of two charts is displayed using a similar technique. It might help you understand more of the concepts.
    http://www.dagira.com/2007/07/31/alerters-on-charts-part-ii/

  • How to display the records based on user input

    Hi all,
    On the front end, there are two date fileds, for example, start and end. Whenever user enters start date and end date, i want to display those dates starting from start date to
    end date whatever the user enters.
    For example, user enters Start date : 01/15/2012  and End date : 01/19/2012
    I want to display like this *01/15/2012 01/16/2012 01/17/2012 01/18/2012 01/19/2012*
    Thanks in advance.
    Thanks,
    Pal

    Hello
    You can generate a range of dates between two supplied variables with something like
    var start_date varchar2(20)
    var end_date varchar2(20)
    exec :start_date:='01/15/2012';
    exec :end_date:='01/19/2012';
    SELECT
        TO_DATE(:start_date,'mm/dd/yyyy') + (rownum-1)
    FROM
        dual
    CONNECT BY
        LEVEL <= (TO_DATE(:end_date,'mm/dd/yyyy') - TO_DATE(:start_date,'mm/dd/yyyy') ) + 1
    TO_DATE(:START_DATE,
    15-JAN-2012 00:00:00
    16-JAN-2012 00:00:00
    17-JAN-2012 00:00:00
    18-JAN-2012 00:00:00
    19-JAN-2012 00:00:00If you want to have them in columns you'd need to set an upper limit for the number of dates and use a pivot
    SELECT
        MAX(CASE WHEN date_idx = 1 THEN dt END) date1,
        MAX(CASE WHEN date_idx = 2 THEN dt END) date2,
        MAX(CASE WHEN date_idx = 3 THEN dt END) date3,
        MAX(CASE WHEN date_idx = 4 THEN dt END) date4,
        MAX(CASE WHEN date_idx = 5 THEN dt END) date5,
        MAX(CASE WHEN date_idx = 6 THEN dt END) date6,
        MAX(CASE WHEN date_idx = 7 THEN dt END) date7,
        MAX(CASE WHEN date_idx = 8 THEN dt END) date8,
        MAX(CASE WHEN date_idx = 9 THEN dt END) date9,
        MAX(CASE WHEN date_idx = 10 THEN dt END) date10
    FROM
        (   SELECT
                rownum date_idx,
                TO_DATE(:start_date,'mm/dd/yyyy') + (rownum-1) dt
            FROM
                dual
            CONNECT BY
                LEVEL <= (TO_DATE(:end_date,'mm/dd/yyyy') - TO_DATE(:start_date,'mm/dd/yyyy') ) + 1
        ) Or failing that, you could use string aggregation like so...
    WITH dates AS
    (   SELECT
            TO_DATE(:start_date,'mm/dd/yyyy') + (rownum-1) dt
        FROM
            dual
        CONNECT BY
            LEVEL <= (TO_DATE(:end_date,'mm/dd/yyyy') - TO_DATE(:start_date,'mm/dd/yyyy') ) + 1
    SELECT LTRIM(MAX(SYS_CONNECT_BY_PATH(TO_CHAR(dt,'mm/dd/yyyy'),' '))
           KEEP (DENSE_RANK LAST ORDER BY curr),',') AS dates
    FROM   (SELECT dt,
                   ROW_NUMBER() OVER (ORDER BY dt) AS curr,
                   ROW_NUMBER() OVER (ORDER BY dt) -1 AS prev
            FROM   dates)
    CONNECT BY prev = PRIOR curr
    START WITH curr = 1
    DATES
    01/15/2012 01/16/2012 01/17/2012 01/18/2012 01/19/2012HTH
    David

  • Calculate local time based on timezone offset

    I am sure this question has been answered many times. but if you can explain me how to calculate local time based on the timezone offset.
    for instance, I am in central time zone. but i want to display local pacific time on my page. I have the timezone offset as -420 minutes.
    Thanks in advance.
    KM

    given a database table tzdata composed of time zone names and tz offset
    i want to be able to display the corresponding Date / Time of each country
    based on the time zone offset .
    in the offsets i posted above i found things like +10.5 ,-1.2 ect..
    how to convert those into the correct format so i can feed it to SimpleTimeZone() construtor ?Why would you want to?
    I am just pointing out here that java already has all those timezones and offsets configured into it. As well as if/when DST applies.
    String[] zones = TimeZone.getAvailableIDs();
            for (int i=0; i<zones.length; i++){
              System.out.println("Zone " + i + " = " + zones[i] + " offset = " + TimeZone.getTimeZone(zones).getRawOffset());
    In other words this database table is reinventing the wheel.
    You just need to tell Java which Timezone you want (according to the standard names for timezones begin Region/City) and it will work out the correct offset.
    eg
    for Afghanistan: new TimeZone("Asia/Kabul");
    Albania: new TimeZone("Europe/Tirane");
    Cheers,
    evnafets

  • How to determine Organizational Data based on User Login

    Dear all,
    How to determine organizational data based on user login in Activity transaction, currently org determination is happening after entering customer number in the transaction.
    We have used 'Responsibility' determination rule for this configuration. Now the requirement is to determine org data based on user login.
    In Org model we have assigned user to org data through a business partner. But still org data is not getting determined in the transaction.
    Please help me to trace out the problem.. your suggestions will be highly appreciated.
    Best regards
    Raghu ram

    You just have to use other organization determination rule. In your case this would be rule 10000194 (ORGMAN_12). This determination rule delivers the responsible organizational unit of the user
    User is defined as a business partner in the container attribute 'PARTNER'. If not, the system user (sy-uname) is used.
    So you have to do the following:
    - use this determination rule
    - in BP link username with employee
    - assign in PPOMA_CRM employee or user to organizational unit
    This should solve your problem.

  • How to get BP kind based on user name?

    Hi,
    How to get BP kind based on user name?
    Is there any table other than BUT000 which gives the Business partner no. and BP KIND?
    What is BLUEPRINT table?

    Hi John,
    do you mean Type:
    1     Person
    2     Organisation
    3     Group
    or Role like
    000000     Business Partner (General)
    BBP000     Vendor
    BBP001     Bidder
    BBP002     Portal Provider
    BBP003     Plant
    BBP004     Purchasing Company
    BEA001     Billing Unit
    BUP001     Contact Person
    BUP002     Prospect
    BUP003     Employee
    BUP004     Organizational Unit
    BUP005     Internet User
    The Role can be found in BUT100.
    Regards
    Gregor

  • Customer exit to calculate previous quarter based on user entry in 0PCALMON

    Hi,
      I have written a CMOD code to calculate previous quarter based on user entry in 0PCALMON (0CALMONTH).  That is if 09.2008 is entered for 0PCALMON, it should fetch the months 04.2008, 05.2008,06.2008.
    But unfortunately I am getting all years and all months.
    Could you please help me debug this code.
    Global Declaration :
           z_vcalmonth(2) TYPE n ,
           z_vcalyear(4) TYPE n.
    When 'YQV_LQ'.
    if i_step = 2.
    READ TABLE i_t_var_range WITH KEY
      vnam = '0PCALMON'
      iobjnm = '0CALMONTH'
      INTO l_s_var_range.
      if sy-subrc = 0.
            z_vcalmonth = l_s_var_range-low+4(2).
            z_vcalyear = l_s_var_range-low(4).
          IF ( z_vcalmonth >= 1 AND z_vcalmonth <= 3 ).
            z_vcalyear = z_vcalyear - 1.
            CONCATENATE z_vcalyear '10' INTO l_s_range-low.
            CONCATENATE z_vcalyear '12' INTO l_s_range-high.
          ENDIF.
          IF ( z_vcalmonth >= 4 AND z_vcalmonth <= 6 ).
            CONCATENATE z_vcalyear '01' INTO l_s_range-low.
            CONCATENATE z_vcalyear '03' INTO l_s_range-high.
          ENDIF.
          IF ( z_vcalmonth >= 7 AND z_vcalmonth <= 9 ).
            CONCATENATE z_vcalyear '04' INTO l_s_range-low.
            CONCATENATE z_vcalyear '06' INTO l_s_range-high.
          ENDIF.
          IF ( z_vcalmonth >= 10 AND z_vcalmonth <= 12 ).
            CONCATENATE z_vcalyear '07' INTO l_s_range-low.
            CONCATENATE z_vcalyear '09' INTO l_s_range-high.
          ENDIF.
          l_s_range-sign = 'I'.
          l_s_range-opt = 'BT'.
          APPEND l_s_range TO e_t_range.
    endif.
    endif.

    Hi,
    U can use the FM SLIM_GET_QUARTERLY_PERIODS
    Pass the variable first date of 0PCALMON ( 09.2009 => '01.09.2009') to get the table of all the 4 period ranges in PERIODS  table in result
    and read the Last entry to get the Previous Quarter period
    PERIODS table
    S OP LOW        HIGH      
    I BT 01.07.2008 30.09.2008
    I BT 01.10.2008 31.12.2008
    I BT 01.01.2009 31.03.2009
    I BT 01.04.2009 30.06.2009
    Then pass this values in l_s_range-low l_s_range-high
    Hope this helps
    Sonal...

  • How to calculate the time between start trigger,first scan and first A/D in DAQ

    Environment: Labview 6.1, N6052E DAQ board(max scan rate=333KHz, max channel rate=333KHz, settling time=3.5usec+1LSB)
    I am using external scan clock 10K scan/s collecting data on 16 AI channels, and external channel clock 200KHz.
    Could show me how to calculate the time betweent he start trigger, the first scan and the first A/D conversion?
    Thanks

    I read the one you give to me. still cannot work out. I am using Labview 6.1 DAQ vi, including AI config.vi. clock config.vi, AI control.vi, AI read.vi, working on colect data on 16 AI channels. So I belong to SCAN function and external scan and sampling timing, right?
    But it says the T1 and T2 are determined by external signals. How can I calculate that?
    T1=1/10KHz or T1=1/160Khz?
    T2=1/200KHz?
    Is the above correct?

  • How to configure the schema name dynamically based on user input.

    configure the schema name dynamically based on user input.
    For ex:
    We have two schemas:
    Schema1  - base schema having 15 tables.
    Schema2 -  tables which is specific to modules. Having only 10 tables which is also available in Schema1
    Login to application using Schema 1
    Access a particlular module and select the country. Here country selection is identified.
    Based on the country selection, we need to connect the schema respectively.
    If the user selects France --> It should connect Schema1
    If the user selects Germeny --> It should connect schema2.
    Used: Eclipselink

    You may want to have a different persistence unit for each country, then you just need to switch persistence units, and can put the schema in your orm.xml file.
    You may also want to investigate EclipseLink multi-tenant support,
    http://www.eclipse.org/eclipselink/documentation/2.5/jpa/extensions/a_multitenant.htm
    You can the schema in a persistence unit in code using a SessionCustomizer and the tableQualifier.

  • How to create database from scratch using user input

    what I am trying to do is to create database via my java code (using hibernate and my sql) and based on user input.
    The details like the name of table.... or the number of columns in it are all supposed to be determined from user input (only the first time).
    On subsequent run the program should remember the previously created database and hence work with it.
    Can somebody help me through this?
    Suppose I did create it using firing queries from my program then the next problem is how my program would start up next time......?????

    Anuvrat wrote:
    what I am trying to do is to create database via my java code (using hibernate and my sql) and based on user input.
    The details like the name of table.... or the number of columns in it are all supposed to be determined from user input (only the first time).
    On subsequent run the program should remember the previously created database and hence work with it.
    Can somebody help me through this?Presumably because you want to (fun) rather than because you need to (job or project.)
    If the second then don't do it.
    >
    Suppose I did create it using firing queries from my program then the next problem is how my program would start up next time......?????You would start by learning about DDL which is the common name for the languages, which vary by database, used to create the entities that represent the structure of a database. Until you figure out the syntax of that you can't do anything in java.

  • Redirect to different pages based on user input value

    Hello,
    Anyone please help.
    I am trying to redirect to different pages based on user inputs. I have a form in which I have one text item and a submit button. For example consider text item to be empno; So once the user enters a empno and hits submit button; I need to redirect to different pages based on this job.
    For Ex: if user inputs empno whose job is 'ANALYST' then redirect to page 1
    if user inputs empno whose job is 'MANAGER' then redirect to page 10
    For this scenario. i wrote a pl/sql process for the submit button; but no luck -- its not at all redirecting instead its in the same page. Below is the process.
    declare
    v_job varchar2(20);
    begin
    select job into v_job from emp where empno = :P9_EMPNO_R;
    if v_job = 'ANALYST' then
    OWA_UTIL.REDIRECT_URL('f?p=&APP_ID.:1:&SESSION.::&DEBUG.::', TRUE);
    end if;
    if v_job = 'MANAGER' then
    OWA_UTIL.REDIRECT_URL('f?p=&APP_ID.:10:&SESSION.::&DEBUG.::', TRUE);
    end if;
    end;Please help. I am using Oracle APEX version 4.2 and database Oracle 11g R2
    Thanks,
    Orton

    orton607 wrote:
    Hello,
    Anyone please help.
    I am trying to redirect to different pages based on user inputs. I have a form in which I have one text item and a submit button. For example consider text item to be empno; So once the user enters a empno and hits submit button; I need to redirect to different pages based on this job.
    For Ex: if user inputs empno whose job is 'ANALYST' then redirect to page 1
    if user inputs empno whose job is 'MANAGER' then redirect to page 10
    For this scenario. i wrote a pl/sql process for the submit button; but no luck -- its not at all redirecting instead its in the same page. Below is the process.
    declare
    v_job varchar2(20);
    begin
    select job into v_job from emp where empno = :P9_EMPNO_R;
    if v_job = 'ANALYST' then
    OWA_UTIL.REDIRECT_URL('f?p=&APP_ID.:1:&SESSION.::&DEBUG.::', TRUE);
    end if;
    if v_job = 'MANAGER' then
    OWA_UTIL.REDIRECT_URL('f?p=&APP_ID.:10:&SESSION.::&DEBUG.::', TRUE);
    end if;
    end;Please help. I am using Oracle APEX version 4.2 and database Oracle 11g R2
    Thanks,
    OrtonI have a similar scenario in my application and this is how I handle it.
    1. Create a page item on the page, say Px_PAGE_NUM
    2. Create a "On Submit - After Computations and Validations" page process to set the above page item. In your case, you can use the same logic that you have already in place (except the call to OWA_UTIL.REDIRECT_URL) :
    declare
    v_job varchar2(20);
    begin
    select job into v_job from emp where empno = :P9_EMPNO_R;
    if v_job = 'ANALYST' then
       :Px_PAGE_NUM := '1';
    end if;
    if v_job = 'MANAGER' then
       :Px_PAGE_NUM := '10';
    end if;
    end;3. Create a "On Submit: After processing" branch. Specify the "Target Type" as "Page in the application" and "Page Number" as &Px_PAGE_NUM. (with the dot).
    I hope the above helps.
    BTW, the following thread in the forum related to OWA_UTIL.REDIRECT_URL might help:
    issue OWA_UTIL.REDIRECT_URL with APEX 4.1.1

  • Drawing a line of asterisks based on user input - where do I start?

    Greetings,
    I'm trying to write an application that will ask the user for a number then the program will output that number in a line of asterisks based on user input - where do I start?
    I really appreciate any informaiton.

    import javax.swing.*;
    public class numbers {
         public static void main ( String args[])
              String strNumber;
              int number = 0;     
              strNumber = "";
         for (int num1 = 0; num1<=5; num1++)
                   strNumber = JOptionPane.showInputDialog ("How many Asterisks do you want printed?");
                   number = Integer.parseInt(strNumber);
              for(int num=0; num<number; num++) System.out.print("*");
                   System.out.println("");
              System.exit(0);
                        }This compiles fine, but it just keep rewriting the same thing... Any suggestions would be greatl appreciated. Also, how would I be able to confine the number entered to under 30?
    THanks

  • Displaying columns based on User Input

    Hi,
    I have a following requirement :
    I have four columns in a report : Performance Indicator ,Target (XTD) , Actual (XTD),Indicator(Traffic Lights)
    Based on the prompt, which contains column named as "Review Frequency" having values as 1. Monthly 2. Quaterly 3. Yearly.
    When User select "Monthly" in pormpt I want to see MTD in Actual and Target column and Indicator depending on these columns.
    When User select "Quaterly" in pormpt I want to see QTD in Actual and Target column and Indicator depending on these columns.
    Can anybody tell me how can we achieve this?
    I think I can achieve this with guided navigation but for that I have to create 3 reports.
    Can anybody have any better idea to create just one report and based on user input I can show/hide columns in a single report?
    This is mainly related to Balanced ScoreCard.
    Thanks in advance
    Regards,
    Vikas

    you have seperate columns for monthly, quarterly, and yearly, right?
    In the prompt, save the "Review Frequency" as a Presentation Variable "abc";
    In the request, you add actual (MTD) column, edit the formula, use something like:
    CASE
    WHEN @{abc}='Monthly' THEN "- SalesFacts"."actual (MTD)"
    WHEN @{abc}='Quarterly' THEN "- SalesFacts"."actual (QTD)"
    ELSE "- SalesFacts"."actual (YTD)"
    END
    then do the same thing for target column.

Maybe you are looking for

  • How do I add another user to my laptop

    I am wanting to add another family member as a user on my laptop. 

  • Removing fields from function profiles

    Hi Some one please help me in removing fields from a function profile. PFA for your reference Regards, Prem

  • Task Dynamic Layout

    I created different layouts for when someone creates a task, and assigned each of those layouts to a Task "Type" option from the picklist. Everything works great when we choose an option in that field, but the initial layout of a task(before complete

  • Mac won't boot up

    It is stuck at the "apple" screen and spinning... any tips? Had not turned it on in several months.

  • Troubleshooting Lightroom 4

    Hi I have trouble with downloading the Lightroom 4 trial version.. There was no problems when i downloaded the Lightroom 3, but when i hit the download button for Lightroom 4 trial nothing happens!? I´m using windows 7 and got plenty of ram and HHD s