Months:  Counting backwards

To create a rolling display in a report I would like to allocate sequence numbers to months (in this case counting backwards).
For example, if the current month is November, then 200611 would be 01, 200610 would be 02, 200609 would be 03, etc.
I can supply a number (neg or pos) to command ADD_MONTHS to calculate months in the future or in the past but is there a way to do the oposite: To declare two months and return the number of months difference between these? For example if the two months are 200603 and 200511, the code would return '4' (Nov 2005 is four months before Mar 2006).
I hope that someone out there has a trick (a snippet of syntax) to do this? That would be a great help to us.
Many thanks,
Alan Searle

select months_between(to_date('200603', 'YYYYMM'), to_date('200511', 'YYYYMM')) from dual
4Regards
Dmytro

Similar Messages

  • Captured TC from BMD counts backwards inside PPro CC

    Setup as following:
    Epic SDI out (1080p25) through BMD DecklinkHD Extreme3D+ captured via PProCC. TC is TOD and shows the correct time on the outputmonitor (JVC-DTV24-G1) when capturewindow is activ.
    But a captured file in projectwindow always shows mediastart at 08.06.40.00 and counts backward (i.E) 08.06.32.00
    When capturing through the BMD Mediaexpress the correct TOD is shown (imported in PProCC.
    Is there a setting what I´m missing or what else can I try?
    thx
    bg
    alex
    updated:
    I just noticed that all captured files (with wrong TC) in the project window are interpreted as upper field first. But my capture settings are defintely  progressiv (not psf, real progressiv)
    Is PPro not able to handle progressive capture ála Epic in a correct way?
    btw:PCwin7/64

    anyone? from Adobe?
    I read all helpfiles, looked at tutorials regarding capturing, but there is no mention about TC via SDI, only capturing via rs232 or firewire, which is from the last century.
    So a question to Adobe:
    Is PPro able to live capture a correct TC over SDI with a BMD card in a professional way?
    thx
    bg
    alex

  • Month count

    Oracle -9i Release 2
    How do I write a sql query to get month-wise count for actual working day, i.e. exclude saturday and sundays from the month count, is there a way to do it, i have the following query that gives total count for each month, also it is not ordered by month.
    SELECT TO_CHAR(xmonth.ddate,'MON'),COUNT(1)
    FROM (SELECT TRUNC(SYSDATE,'mon') + ROWNUM - 1 ddate
    FROM ALL_OBJECTS
    WHERE TRUNC(SYSDATE,'mon') + ROWNUM - 1 <= LAST_DAY(TO_DATE('12/31/2005','mm/dd/yyyy')) ) xmonth
    GROUP BY TO_CHAR(xmonth.ddate,'MON')

    The following example should help.
      1  SELECT TO_CHAR(MYDATE,'MONTH YYYY') MONTH, COUNT(*) COUNT
      2  FROM(SELECT DATE '2004-01-01'+ ROWNUM -1 MYDATE
      3         FROM(SELECT 1 FROM DUAL
      4               GROUP BY CUBE(1,2,3,4,5,6,7,8,9)))
      5  WHERE MYDATE < DATE '2005-01-01'
      6  AND TO_CHAR(MYDATE,'DY') NOT IN ('SAT','SUN')
      7  GROUP BY TO_CHAR(MYDATE,'MONTH YYYY')
      8* ORDER BY TO_DATE(TO_CHAR(MYDATE,'MONTH YYYY'),'MONTH YYYY')
    SQL> /
    MONTH                               COUNT
    JANUARY   2004                         22
    FEBRUARY  2004                         20
    MARCH     2004                         23
    APRIL     2004                         22
    MAY       2004                         21
    JUNE      2004                         22
    JULY      2004                         22
    AUGUST    2004                         22
    SEPTEMBER 2004                         22
    OCTOBER   2004                         21
    NOVEMBER  2004                         22
    DECEMBER  2004                         23
    12 rows selected.
    SQL> disconnect
    Disconnected from Oracle9i Enterprise Edition Release 9.2.0.3.0 - 64bit Production
    With the Partitioning, OLAP and Oracle Data Mining options
    JServer Release 9.2.0.3.0 - Production

  • What is the name of that thing that appears before a film, in black and white, with numbers counting backwards and with circle motion ?

    what is the name of that thing that appears before a film, in black and white, with numbers counting backwards and with circle motion ?

    Thanks a lot, not only I got what I needed, but also discovered a great site
    thanks
    fp

  • Help To Count Backwards

    Hi,
    Im very new to Java, started two weeks ago at uni, i missed most of this semester due to illness, i was not looking forward to coming back having missed sooo much but found i quite like Java.
    We have been given our project to build a gui phone (point and click, basic stuff) which accepts various coin amounts, works out the time for the call by simple math.
    What i cannot do for the life of me, or even get my head around is counting backwards the time for the call. I have looked at sleep() count() and wait() but seen to get caught in the loop.
    Here is the code:
        private void jBtnCallMouseClicked(java.awt.event.MouseEvent evt) {                                     
            String tempTime;
            int time;
            tempTime = jLblCallDurationTime.getText();
            time = Integer.parseInt(tempTime);
            while (time > 0){
                try {
                    time = time - 1;
                    Thread.sleep(1000);               
                } catch (InterruptedException e) {
                    jLblCallDurationTime.setText(Integer.toString(time));
        } I do not quite understand the try & catch, im a noob, please go easy, we are doing all coding within the main class.
    Additionally, i would like to post the entire code for pointers on bad habits if anyone has time?
    Regards
    Doo

    Thanks for your replies guy's,
    I was trying to setText() in the catch??? is this not write.
    I want the gui to be responsive as users need to deposit more coins as the seconds timer gets below a certain amount.
    Here is the whole main class code.
    Ill check back later, im getting ear ache from my wife for spending too much time on this...lol Any help or advice is greatly apprieciated. (i have a lot of repeated code i know) but as i said my Java is only two weeks old!
    import java.util.concurrent.CountDownLatch;
    import javax.swing.filechooser.FileView;
    * PhoneProject.java
    * Created on 29 April 2007, 14:15
    * @author  Dooie & Rooney
    public class PhoneProject extends javax.swing.JFrame {
        /** Creates new form PhoneProject */
        public PhoneProject() {
            initComponents();
        /** This method is called from within the constructor to
         * initialize the form.
         * WARNING: Do NOT modify this code. The content of this method is
         * always regenerated by the Form Editor.
        // <editor-fold defaultstate="collapsed" desc=" Generated Code ">//GEN-BEGIN:initComponents
        private void initComponents() {
            buttonGroupCallType = new javax.swing.ButtonGroup();
            jBtn5 = new javax.swing.JButton();
            jBtn10 = new javax.swing.JButton();
            jBtn20 = new javax.swing.JButton();
            jBtn50 = new javax.swing.JButton();
            jBtn100 = new javax.swing.JButton();
            jLblCredit = new javax.swing.JLabel();
            jLblCreditAmount = new javax.swing.JLabel();
            jRadBtnLocal = new javax.swing.JRadioButton();
            jRadBtnLong = new javax.swing.JRadioButton();
            jRadBtnInter = new javax.swing.JRadioButton();
            jLblCallDuration = new javax.swing.JLabel();
            jLblCallDurationTime = new javax.swing.JLabel();
            jLblCallDurationSeconds = new javax.swing.JLabel();
            jBtnCall = new javax.swing.JButton();
            jBtnNum1 = new javax.swing.JButton();
            jBtnNum2 = new javax.swing.JButton();
            jBtnNum3 = new javax.swing.JButton();
            jBtnNum4 = new javax.swing.JButton();
            jBtnNum5 = new javax.swing.JButton();
            jBtnNum6 = new javax.swing.JButton();
            jBtnNum7 = new javax.swing.JButton();
            jBtnNum8 = new javax.swing.JButton();
            jBtnNum9 = new javax.swing.JButton();
            jBtnNum0 = new javax.swing.JButton();
            jTxtDisplayScreen = new javax.swing.JTextField();
            jBtnClear = new javax.swing.JButton();
            jBtnCalls = new javax.swing.JButton();
            jLblInfo = new javax.swing.JLabel();
            jLblInfoTitle = new javax.swing.JLabel();
            jLblCoinType = new javax.swing.JLabel();
            jLblCoinType_1 = new javax.swing.JLabel();
            jLblSelectedCallType = new javax.swing.JLabel();
            setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
            setResizable(false);
            addMouseListener(new java.awt.event.MouseAdapter() {
                public void mouseClicked(java.awt.event.MouseEvent evt) {
                    formMouseClicked(evt);
            jBtn5.setFont(new java.awt.Font("Verdana", 0, 11));
            jBtn5.setText("5p");
            jBtn5.addMouseListener(new java.awt.event.MouseAdapter() {
                public void mouseClicked(java.awt.event.MouseEvent evt) {
                    jBtn5MouseClicked(evt);
            jBtn10.setFont(new java.awt.Font("Verdana", 0, 11));
            jBtn10.setText("10p");
            jBtn10.addMouseListener(new java.awt.event.MouseAdapter() {
                public void mouseClicked(java.awt.event.MouseEvent evt) {
                    jBtn10MouseClicked(evt);
            jBtn20.setFont(new java.awt.Font("Verdana", 0, 11));
            jBtn20.setText("20p");
            jBtn20.addMouseListener(new java.awt.event.MouseAdapter() {
                public void mouseClicked(java.awt.event.MouseEvent evt) {
                    jBtn20MouseClicked(evt);
            jBtn50.setFont(new java.awt.Font("Verdana", 0, 11));
            jBtn50.setText("50p");
            jBtn50.addMouseListener(new java.awt.event.MouseAdapter() {
                public void mouseClicked(java.awt.event.MouseEvent evt) {
                    jBtn50MouseClicked(evt);
            jBtn100.setFont(new java.awt.Font("Verdana", 0, 11));
            jBtn100.setText("\u00a31");
            jBtn100.addMouseListener(new java.awt.event.MouseAdapter() {
                public void mouseClicked(java.awt.event.MouseEvent evt) {
                    jBtn100MouseClicked(evt);
            jLblCredit.setFont(new java.awt.Font("Verdana", 0, 14));
            jLblCredit.setText("Credit");
            jLblCreditAmount.setFont(new java.awt.Font("Verdana", 0, 14));
            jLblCreditAmount.setText("0");
            buttonGroupCallType.add(jRadBtnLocal);
            jRadBtnLocal.setText("Local");
            jRadBtnLocal.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0, 0));
            jRadBtnLocal.setMargin(new java.awt.Insets(0, 0, 0, 0));
            jRadBtnLocal.addMouseListener(new java.awt.event.MouseAdapter() {
                public void mouseClicked(java.awt.event.MouseEvent evt) {
                    jRadBtnLocalMouseClicked(evt);
            jRadBtnLocal.addActionListener(new java.awt.event.ActionListener() {
                public void actionPerformed(java.awt.event.ActionEvent evt) {
                    jRadBtnLocalActionPerformed(evt);
            buttonGroupCallType.add(jRadBtnLong);
            jRadBtnLong.setText("Long Distance");
            jRadBtnLong.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0, 0));
            jRadBtnLong.setMargin(new java.awt.Insets(0, 0, 0, 0));
            jRadBtnLong.addMouseListener(new java.awt.event.MouseAdapter() {
                public void mouseClicked(java.awt.event.MouseEvent evt) {
                    jRadBtnLongMouseClicked(evt);
            buttonGroupCallType.add(jRadBtnInter);
            jRadBtnInter.setText("International");
            jRadBtnInter.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0, 0));
            jRadBtnInter.setMargin(new java.awt.Insets(0, 0, 0, 0));
            jRadBtnInter.addMouseListener(new java.awt.event.MouseAdapter() {
                public void mouseClicked(java.awt.event.MouseEvent evt) {
                    jRadBtnInterMouseClicked(evt);
            jLblCallDuration.setBackground(new java.awt.Color(255, 255, 255));
            jLblCallDuration.setFont(new java.awt.Font("Verdana", 0, 14));
            jLblCallDuration.setText("Call Duration");
            jLblCallDurationTime.setFont(new java.awt.Font("Verdana", 0, 14));
            jLblCallDurationTime.setText("0");
            jLblCallDurationTime.addInputMethodListener(new java.awt.event.InputMethodListener() {
                public void caretPositionChanged(java.awt.event.InputMethodEvent evt) {
                public void inputMethodTextChanged(java.awt.event.InputMethodEvent evt) {
                    jLblCallDurationTimeInputMethodTextChanged(evt);
            jLblCallDurationSeconds.setFont(new java.awt.Font("Verdana", 0, 14));
            jLblCallDurationSeconds.setText("Seconds");
            jBtnCall.setFont(new java.awt.Font("Verdana", 0, 11));
            jBtnCall.setText("Call");
            jBtnCall.addMouseListener(new java.awt.event.MouseAdapter() {
                public void mouseClicked(java.awt.event.MouseEvent evt) {
                    jBtnCallMouseClicked(evt);
            jBtnNum1.setFont(new java.awt.Font("Verdana", 0, 11));
            jBtnNum1.setText("1");
            jBtnNum1.addMouseListener(new java.awt.event.MouseAdapter() {
                public void mouseClicked(java.awt.event.MouseEvent evt) {
                    jBtnNum1MouseClicked(evt);
            jBtnNum2.setFont(new java.awt.Font("Verdana", 0, 11));
            jBtnNum2.setText("2");
            jBtnNum2.addMouseListener(new java.awt.event.MouseAdapter() {
                public void mouseClicked(java.awt.event.MouseEvent evt) {
                    jBtnNum2MouseClicked(evt);
            jBtnNum3.setFont(new java.awt.Font("Verdana", 0, 11));
            jBtnNum3.setText("3");
            jBtnNum3.addMouseListener(new java.awt.event.MouseAdapter() {
                public void mouseClicked(java.awt.event.MouseEvent evt) {
                    jBtnNum3MouseClicked(evt);
            jBtnNum4.setFont(new java.awt.Font("Verdana", 0, 11));
            jBtnNum4.setText("4");
            jBtnNum4.addMouseListener(new java.awt.event.MouseAdapter() {
                public void mouseClicked(java.awt.event.MouseEvent evt) {
                    jBtnNum4MouseClicked(evt);
            jBtnNum5.setFont(new java.awt.Font("Verdana", 0, 11));
            jBtnNum5.setText("5");
            jBtnNum5.addMouseListener(new java.awt.event.MouseAdapter() {
                public void mouseClicked(java.awt.event.MouseEvent evt) {
                    jBtnNum5MouseClicked(evt);
            jBtnNum6.setFont(new java.awt.Font("Verdana", 0, 11));
            jBtnNum6.setText("6");
            jBtnNum6.addMouseListener(new java.awt.event.MouseAdapter() {
                public void mouseClicked(java.awt.event.MouseEvent evt) {
                    jBtnNum6MouseClicked(evt);
            jBtnNum7.setFont(new java.awt.Font("Verdana", 0, 11));
            jBtnNum7.setText("7");
            jBtnNum7.addMouseListener(new java.awt.event.MouseAdapter() {
                public void mouseClicked(java.awt.event.MouseEvent evt) {
                    jBtnNum7MouseClicked(evt);
            jBtnNum8.setFont(new java.awt.Font("Verdana", 0, 11));
            jBtnNum8.setText("8");
            jBtnNum8.addMouseListener(new java.awt.event.MouseAdapter() {
                public void mouseClicked(java.awt.event.MouseEvent evt) {
                    jBtnNum8MouseClicked(evt);
            jBtnNum9.setFont(new java.awt.Font("Verdana", 0, 11));
            jBtnNum9.setText("9");
            jBtnNum9.addMouseListener(new java.awt.event.MouseAdapter() {
                public void mouseClicked(java.awt.event.MouseEvent evt) {
                    jBtnNum9MouseClicked(evt);
            jBtnNum0.setFont(new java.awt.Font("Verdana", 0, 11));
            jBtnNum0.setText("0");
            jBtnNum0.addMouseListener(new java.awt.event.MouseAdapter() {
                public void mouseClicked(java.awt.event.MouseEvent evt) {
                    jBtnNum0MouseClicked(evt);
            jTxtDisplayScreen.setFont(new java.awt.Font("Tahoma", 1, 12));
            jBtnClear.setFont(new java.awt.Font("Verdana", 0, 11));
            jBtnClear.setText("C");
            jBtnClear.addMouseListener(new java.awt.event.MouseAdapter() {
                public void mouseClicked(java.awt.event.MouseEvent evt) {
                    jBtnClearMouseClicked(evt);
            jBtnCalls.setFont(new java.awt.Font("Verdana", 0, 11));
            jBtnCalls.setText("Reg");
            jBtnCalls.setActionCommand("Calls");
            jBtnCalls.addMouseListener(new java.awt.event.MouseAdapter() {
                public void mouseClicked(java.awt.event.MouseEvent evt) {
                    jBtnCallsMouseClicked(evt);
            jLblInfo.setFont(new java.awt.Font("Verdana", 0, 14));
            jLblInfo.setForeground(new java.awt.Color(255, 0, 0));
            jLblInfo.setText("Please Select Call Type");
            jLblInfoTitle.setFont(new java.awt.Font("Verdana", 0, 14));
            jLblInfoTitle.setForeground(new java.awt.Color(255, 0, 0));
            jLblInfoTitle.setText("Infomation:");
            jLblCoinType.setFont(new java.awt.Font("Verdana", 0, 24));
            jLblCoinType_1.setFont(new java.awt.Font("Verdana", 0, 11));
            jLblSelectedCallType.setFont(new java.awt.Font("Verdana", 0, 14));
            jLblSelectedCallType.setText("Call Type:");
            javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
            getContentPane().setLayout(layout);
            layout.setHorizontalGroup(
                layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(layout.createSequentialGroup()
                    .addGap(16, 16, 16)
                    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                        .addComponent(jLblSelectedCallType)
                        .addGroup(layout.createSequentialGroup()
                            .addComponent(jLblInfoTitle)
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                            .addComponent(jLblInfo))
                        .addGroup(layout.createSequentialGroup()
                            .addComponent(jLblCallDuration)
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                            .addComponent(jLblCallDurationTime)
                            .addGap(6, 6, 6)
                            .addComponent(jLblCallDurationSeconds))
                        .addGroup(layout.createSequentialGroup()
                            .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                .addGroup(layout.createSequentialGroup()
                                    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                        .addComponent(jRadBtnLocal)
                                        .addComponent(jRadBtnLong)
                                        .addComponent(jRadBtnInter)
                                        .addGroup(layout.createSequentialGroup()
                                            .addComponent(jLblCoinType)
                                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                            .addComponent(jLblCoinType_1)))
                                    .addGap(18, 18, 18)
                                    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                                        .addComponent(jBtn50, javax.swing.GroupLayout.DEFAULT_SIZE, 60, Short.MAX_VALUE)
                                        .addComponent(jBtn20, javax.swing.GroupLayout.DEFAULT_SIZE, 60, Short.MAX_VALUE)
                                        .addComponent(jBtn10, javax.swing.GroupLayout.DEFAULT_SIZE, 60, Short.MAX_VALUE)
                                        .addComponent(jBtn5, javax.swing.GroupLayout.DEFAULT_SIZE, 50, Short.MAX_VALUE)
                                        .addComponent(jBtn100, javax.swing.GroupLayout.PREFERRED_SIZE, 60, javax.swing.GroupLayout.PREFERRED_SIZE)))
                                .addGroup(layout.createSequentialGroup()
                                    .addComponent(jLblCredit)
                                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                    .addComponent(jLblCreditAmount, javax.swing.GroupLayout.PREFERRED_SIZE, 60, javax.swing.GroupLayout.PREFERRED_SIZE)))
                            .addGap(6, 6, 6)
                            .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                                .addComponent(jTxtDisplayScreen)
                                .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                                    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                        .addComponent(jBtnNum1, javax.swing.GroupLayout.DEFAULT_SIZE, 60, Short.MAX_VALUE)
                                        .addComponent(jBtnNum4, javax.swing.GroupLayout.DEFAULT_SIZE, 60, Short.MAX_VALUE)
                                        .addComponent(jBtnNum7, javax.swing.GroupLayout.DEFAULT_SIZE, 60, Short.MAX_VALUE)
                                        .addComponent(jBtnCall, javax.swing.GroupLayout.DEFAULT_SIZE, 60, Short.MAX_VALUE))
                                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                        .addComponent(jBtnNum5, javax.swing.GroupLayout.DEFAULT_SIZE, 60, Short.MAX_VALUE)
                                        .addComponent(jBtnNum8, javax.swing.GroupLayout.DEFAULT_SIZE, 60, Short.MAX_VALUE)
                                        .addComponent(jBtnNum2, javax.swing.GroupLayout.DEFAULT_SIZE, 60, Short.MAX_VALUE)
                                        .addComponent(jBtnCalls, javax.swing.GroupLayout.PREFERRED_SIZE, 60, javax.swing.GroupLayout.PREFERRED_SIZE)
                                        .addComponent(jBtnNum0, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 60, Short.MAX_VALUE))
                                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                                        .addComponent(jBtnClear, javax.swing.GroupLayout.PREFERRED_SIZE, 60, javax.swing.GroupLayout.PREFERRED_SIZE)
                                        .addComponent(jBtnNum3, javax.swing.GroupLayout.DEFAULT_SIZE, 60, Short.MAX_VALUE)
                                        .addComponent(jBtnNum9, javax.swing.GroupLayout.DEFAULT_SIZE, 60, Short.MAX_VALUE)
                                        .addComponent(jBtnNum6, javax.swing.GroupLayout.PREFERRED_SIZE, 60, javax.swing.GroupLayout.PREFERRED_SIZE))))))
                    .addContainerGap(19, Short.MAX_VALUE))
            layout.setVerticalGroup(
                layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(layout.createSequentialGroup()
                    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                        .addGroup(layout.createSequentialGroup()
                            .addGap(22, 22, 22)
                            .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                .addGroup(layout.createSequentialGroup()
                                    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                        .addComponent(jRadBtnLocal)
                                        .addComponent(jBtn5)
                                        .addComponent(jTxtDisplayScreen, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                        .addComponent(jRadBtnLong)
                                        .addComponent(jBtn10))
                                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                        .addComponent(jBtn20)
                                        .addComponent(jRadBtnInter))
                                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                        .addComponent(jBtn50)
                                        .addComponent(jBtnNum4)
                                        .addComponent(jBtnNum5)
                                        .addComponent(jBtnNum6))
                                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                        .addComponent(jBtn100)
                                        .addComponent(jBtnNum7)
                                        .addComponent(jBtnNum8)
                                        .addComponent(jBtnNum9)))
                                .addGroup(layout.createSequentialGroup()
                                    .addGap(29, 29, 29)
                                    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                        .addComponent(jBtnClear)
                                        .addComponent(jBtnCall)
                                        .addComponent(jBtnCalls))
                                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                        .addComponent(jBtnNum1)
                                        .addComponent(jBtnNum3)
                                        .addComponent(jBtnNum2))))
                            .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                .addGroup(layout.createSequentialGroup()
                                    .addGap(21, 21, 21)
                                    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                        .addComponent(jLblCreditAmount)
                                        .addComponent(jLblCredit))
                                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                        .addComponent(jLblCallDuration)
                                        .addComponent(jLblCallDurationTime)
                                        .addComponent(jLblCallDurationSeconds)))
                                .addGroup(layout.createSequentialGroup()
                                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                    .addComponent(jBtnNum0)))
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED))
                        .addGroup(layout.createSequentialGroup()
                            .addContainerGap(146, Short.MAX_VALUE)
                            .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                .addComponent(jLblCoinType)
                                .addComponent(jLblCoinType_1))
                            .addGap(84, 84, 84)))
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                    .addComponent(jLblSelectedCallType)
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(jLblInfoTitle)
                        .addComponent(jLblInfo))
                    .addGap(28, 28, 28))
            pack();
        }// </editor-fold>//GEN-END:initComponents
        private void jBtnCallMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jBtnCallMouseClicked
            String tempTime;
            int time;
            tempTime = jLblCallDurationTime.getText();
            time = Integer.parseInt(tempTime);
            while (time > 0){
                try {
                    time = time - 1;
                    Thread.sleep(1000);               
                } catch (InterruptedException e) {
                    jLblCallDurationTime.setText(Integer.toString(time));
        }//GEN-LAST:event_jBtnCallMouseClicked
        private void jBtnClearMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jBtnClearMouseClicked
            jTxtDisplayScreen.setText("");
        }//GEN-LAST:event_jBtnClearMouseClicked
        private void jRadBtnInterMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jRadBtnInterMouseClicked
            jLblInfo.setText("Please Deposit Coins, 30p Minimum...");
            jLblSelectedCallType.setText("You are making an International");
        }//GEN-LAST:event_jRadBtnInterMouseClicked
        private void jRadBtnLongMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jRadBtnLongMouseClicked
            jLblInfo.setText("Please Deposit Coins, 30p Minimum...");
            jLblSelectedCallType.setText("You are making a Long Distance Call");
        }//GEN-LAST:event_jRadBtnLongMouseClicked
        private void jBtnCallsMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jBtnCallsMouseClicked
        }//GEN-LAST:event_jBtnCallsMouseClicked
        private void jBtnNum0MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jBtnNum0MouseClicked
            String oldNumber;                           //set oldNumber to String
            String newNumber;                           //set newNumber as a String
            String tempCreditAmount;
            int coinAmount;
            boolean selectionLocal;                             //set boolean call type
            boolean selectionLong;                              //set boolean call type
            boolean selectionInter;                             //set boolean call type
            tempCreditAmount = jLblCreditAmount.getText();
            coinAmount = Integer.parseInt(tempCreditAmount);
            selectionLocal = jRadBtnLocal.isSelected();         //get selected
            selectionLong = jRadBtnLong.isSelected();           //get selected
            selectionInter = jRadBtnInter.isSelected();         //get selected
    //        if ((selectionLocal == false) || (selectionLong == false) || (selectionLong == false)){
    //            jLblInfo.setText("You have not selected a call type");
            if (coinAmount == 0) {                              //check coins are deposited
                jLblInfo.setText("Select call-type & add money...");
            } else if (coinAmount < 30) {                       //checks minimum coins amount
                jLblInfo.setText("You need to deposit more coins...");
            } else {
                jLblInfo.setText("");
                oldNumber = jTxtDisplayScreen.getText();    //get txt, if any, assign to oldNumber
                newNumber = oldNumber + "0";                //set newNumber as oldNumber adding String to end
                jTxtDisplayScreen.setText(newNumber);       //Display newNumber
        }//GEN-LAST:event_jBtnNum0MouseClicked
        private void jBtnNum9MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jBtnNum9MouseClicked
            String oldNumber;                           //set oldNumber to String
            String newNumber;                           //set newNumber as a String
            String tempCreditAmount;
            int coinAmount;
            boolean selectionLocal;                             //set boolean call type
            boolean selectionLong;                              //set boolean call type
            boolean selectionInter;                             //set boolean call type
            tempCreditAmount = jLblCreditAmount.getText();
            coinAmount = Integer.parseInt(tempCreditAmount);
            selectionLocal = jRadBtnLocal.isSelected();         //get selected
            selectionLong = jRadBtnLong.isSelected();           //get selected
            selectionInter = jRadBtnInter.isSelected();         //get selected
    //        if ((selectionLocal == false) || (selectionLong == false) || (selectionLong == false)){
    //            jLblInfo.setText("You have not selected a call type");
            if (coinAmount == 0) {                              //check coins are deposited
                jLblInfo.setText("Select call-type & add money...");
            } else if (coinAmount < 30) {                       //checks minimum coins amount
                jLblInfo.setText("You need to deposit more coins...");
            } else {
                jLblInfo.setText("");
                oldNumber = jTxtDisplayScreen.getText();    //get txt, if any, assign to oldNumber
                newNumber = oldNumber + "9";                //set newNumber as oldNumber adding String to end
                jTxtDisplayScreen.setText(newNumber);       //Display newNumber
        }//GEN-LAST:event_jBtnNum9MouseClicked
        private void jBtnNum8MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jBtnNum8MouseClicked
            String oldNumber;                           //set oldNumber to String
            String newNumber;                           //set newNumber as a String
            String tempCreditAmount;
            int coinAmount;
            boolean selectionLocal;                             //set boolean call type
            boolean selectionLong;                              //set boolean call type
            boolean selectionInter;                             //set boolean call type
            tempCreditAmount = jLblCreditAmount.getText();
            coinAmount = Integer.parseInt(tempCreditAmount);
            selectionLocal = jRadBtnLocal.isSelected();         //get selected
            selectionLong = jRadBtnLong.isSelected();           //get selected
            selectionInter = jRadBtnInter.isSelected();         //get selected
    //        if ((selectionLocal == false) || (selectionLong == false) || (selectionLong == false)){
    //            jLblInfo.setText("You have not selected a call type");
            if (coinAmount == 0) {                              //check coins are deposited
                jLblInfo.setText("Select call-type & add money...");
            } else if (coinAmount < 30) {                       //checks minimum coins amount
                jLblInfo.setText("You need to deposit more coins...");
            } else {
                jLblInfo.setText("");
                oldNumber = jTxtDispla                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         

  • Counting backwards

    public class ASMT13_LemireE
    static Console c; // The output console
    public static void main (String[] args)
    c = new Console (); //'c' is the output console
    // Place your program here:
    c.print("Please enter the number 50:");
    int EnteredNumber = c.readInt();
    EnteredNumber = 50;
    for(int i = 0; i <= 20; i++)
    c.print(EnteredNumber-i+ " ");
    up above is the code i have, ive almost got it, but i need the program to automatically start with the number 50 and count backwards to 30, i can do that but the user has to enter the number which i dont want, but i cant figure out how to fix it. Also does anyone know how to make it so that when it counts it will count like this:
    50 49 48 47
    46 45 44 43
    and so on to 30

    > sorry about the code and i will use the code button
    next time, sorry about the packages i thought i
    grabbed them when i copied it all, must have missed
    it sorry bout that.
    No problem. ; )
    > Although i still do not know how to make it divide
    into colums where it goes 4 numbers accross then down
    to the next line then 4 more numbers and down and so
    on.
    I know its something like Colums = 4 or something
    like that i just dont know the exact code for it if
    you could help me with that i would appreciate it.
    Here's a hint:
    import hsa.Console;
    public class ASMT13_LemireE
        static Console c;
        public static void main (String[] args)
            c = new Console();
            c.print("Please enter a number: ");
            int EnteredNumber = c.readInt();
            int charactersPrinted = 0;
            int maxColumns = 4;
            for(int i = EnteredNumber; i >= EnteredNumber - 20; i--)
                c.print(i+" ");
                // Increase charactersPrinted by 1
                // If charactersPrinted equals maxColumns
                //  - print an empty line on the console (Console.println())
                //  - reset the charactersPrinted variable to 0
    > import java.awt.*;
    import hsa.Console;
    You don't need the java.awt to be imported.

  • Month count from 0CALMONTH

    I am trying to get the count of the month from 0CALMONTH using an exit variable. Is this code correct? Thanks.
      WHEN 'ZMONTHCT'.
        IF i_step = 2.
    data: month_num type i.
            LOOP AT I_T_var_range
               INTO loc_var_range WHERE vnam = '0PCALMONTH' or
                                        vnam = 'ZCMONTH2' OR
                             vnam = 'ZCMONTH3' OR
                             vnam = 'ZCMONTH4'.
            month_num = loc_var_range-low+4(2).
            l_S_range-low = month_num.
            l_s_range-sign = 'I'.
            l_s_range-opt = 'EQ'.
            APPEND l_s_range TO E_T_range.
            EXIT.
          ENDLOOP.
        ENDIF.

    sohini,
    Instead of doing all that...
    Take the calmonth variable value - have a formula variable in your query to get the text value of the charactewristic..
    Lets take 022007...
    The internal format would be 022007 use the formula to calculate absolute value of (022007 / 10000) you would get 2 which is what you want - you need not use any exit for this or use the other number functions to get the value that you want when you divide this value by 10000 ...
    Arun
    Assign points if useful

  • Measument point - Counter - Backwards - Over flow limit value ?

    Hi ,
       I 'm trying to use measurement point, the requirement is i need to start from 20000 hours and  go on decreasing the life of the part and when i reach 1000 hours i need the system to tell me so. i'm not able to update the upper and lower limits in reverse, neither i'm knowing what to put for over flow counter reading. Please help.
    Regards,
    Vivek

    HI Experts,
    I am looking for information relating to setting up backward counters to schedule Maintenance Plans. When I try to create a Maintenance Plan linked to a Backward Counter, I receive the error "Only counters that run forwards can be entered - Error IP124" . What am I doing wrong?  How can I use backwards counters with maintenance plans?
    We have several clocks that count down the hours til the next major or minor pm is due. The technician manually records the time from these clocks. Worst case is that we can subtract the counter time from a constant if we have to, but I'd like to have the technician enter in the clock time directly with out any manipulation needed.
    Thanks in advance,
    Please open a thread for your specific issue
    -Paul (moderator)
    Edited by: Paul Meehan on Oct 24, 2011 2:06 PM

  • Count days in a month for a date range

    i am trying to find no. of days between 2 Date Ranges for a list of Ids. i used the logic in the below link:
    count days of the month
    My query is giving duplicates since, I have list of Ids.
    Doctor_ID     Patient_ID     ARRIVE_DT_TM     DISCH_DT_TM
    755722     42972229     10/18/2012 7:50     3/14/2013 20:45
    763305     42972232     1/7/2013 20:27     3/15/2013 19:15
    25391509     42972298     2/4/2013 22:45     3/8/2013 22:03
    746779     42972331     1/4/2013 23:00     3/26/2013 21:50
    763305     42972338     3/4/2013 22:19     3/6/2013 19:35
    763305     42972411     11/4/2013 22:32     3/29/2013 17:30
    I am looking for query to give me for Patient_ID = 42972229
    MONTH     COUNT_DAYS
    201210     14
    201211     30
    201212     31
    201301     31
    201302     28
    201303     14
    I am running the following code and it loops through the months and gives duplicates when I remove where Patient_id IN (42972229)
    select
    Doctor_ID
    , Patient_ID
    , AR_DTTM
    , DSC_DTTM
    , TO_CHAR(ADD_MONTHS(TRUNC(date1, 'MONTH'), LEVEL - 1), 'YYYY MM') MONTHS_BET
    , (LEAST(date2, ADD_MONTHS(TRUNC(date1, 'MONTH') - 1, LEVEL)) - GREATEST(date1, ADD_MONTHS(TRUNC(date1, 'MONTH'), LEVEL - 1)))+ 1 AS DAYSCOUNT
    from (select
    Doctor_ID
    , Patient_ID
    , ARRIVE_DT_TM AR_DTTM
    , DISCH_DT_TM DSC_DTTM
    ,TRUNC(ARRIVE_DT_TM,'DDD') AS date1
    ,TRUNC(DISCH_DT_TM,'DDD') AS date2
    from temp where Patient_id IN (42972229)
    CONNECT BY LEVEL <= MONTHS_BETWEEN(TRUNC(date2, 'MONTH'), TRUNC(date1, 'MONTH')) + 1
    Please help!

    Hi,
    ASTRA_007 wrote:
    Results I would like to see are:
    Doctor_ID     Patient_ID     ARRIVE_DT_TM     DISCH_DT_TM     Month     CountofDays
    755722     42972229     10/18/2012 7:50     3/14/2013 20:45     2012 10     14
    755722     42972229     10/18/2012 7:50     3/14/2013 20:45     2012 11     30
    755722     42972229     10/18/2012 7:50     3/14/2013 20:45     2012 12     31
    755722     42972229     10/18/2012 7:50     3/14/2013 20:45     2013 01     31
    755722     42972229     10/18/2012 7:50     3/14/2013 20:45     2013 02     28
    755722     42972229     10/18/2012 7:50     3/14/2013 20:45     2013 03     14
    763305     42972232     1/7/2013 20:27     3/15/2013 19:15     2013 01     25
    763305     42972232     1/7/2013 20:27     3/15/2013 19:15     2013 02     28
    763305     42972232     1/7/2013 20:27     3/15/2013 19:15     2013 03     15
    and so on...So each row represents a patient-month, and you want to display several columns from the temp table on each output row. In that case, include all those columns in both the SELECT and GROUP BY clauses, like this:
    WITH     universe     AS
         SELECT     *
         FROM     temp
    --     WHERE     patient_id     IN (42972229)
    ,     date_range     AS
         SELECT     TRUNC (MIN (arrive_dt_tm))     AS first_date
         ,     TRUNC (MAX (disch_dt_tm))     AS last_date
         FROM     universe
    ,     all_dates     AS
         SELECT     first_date + LEVEL - 1     AS a_date
         FROM     date_range
         CONNECT BY     LEVEL     <= (last_date + 1) - first_date
    SELECT    u.doctor_id
    ,       u.patient_id
    ,       u.arrive_dt_tm
    ,       u.disch_dt_tm
    ,       TO_CHAR ( TRUNC (a.a_date, 'MONTH')
                  , 'YYYY MM'
                )          AS month
    ,       COUNT (*)          AS count_days
    FROM       all_dates  a
    JOIN       universe   u  ON  a.a_date  BETWEEN  TRUNC (u.arrive_dt_tm)
                                         AND      u.disch_dt_tm
    GROUP BY  u.doctor_id
    ,       u.patient_id
    ,       u.arrive_dt_tm
    ,       u.disch_dt_tm
    ,         TRUNC (a.a_date, 'MONTH')
    ORDER BY  u.patient_id
    ,       TRUNC (a.a_date, 'MONTH')
    ;Output from your sample data (with no filtering):
    `DOCTOR_ID PATIENT_ID ARRIVE_DT_TM     DISCH_DT_TM      MONTH   COUNT_DAYS
        755722   42972229 10/18/2012 7:50  3/14/2013 20:45  2012 10         14
        755722   42972229 10/18/2012 7:50  3/14/2013 20:45  2012 11         30
        755722   42972229 10/18/2012 7:50  3/14/2013 20:45  2012 12         31
        755722   42972229 10/18/2012 7:50  3/14/2013 20:45  2013 01         31
        755722   42972229 10/18/2012 7:50  3/14/2013 20:45  2013 02         28
        755722   42972229 10/18/2012 7:50  3/14/2013 20:45  2013 03         14
        763305   42972232 1/7/2013 20:27   3/15/2013 19:15  2013 01         25
        763305   42972232 1/7/2013 20:27   3/15/2013 19:15  2013 02         28
        763305   42972232 1/7/2013 20:27   3/15/2013 19:15  2013 03         15
      25391509   42972298 2/4/2013 22:45   3/8/2013 22:3    2013 02         25
      25391509   42972298 2/4/2013 22:45   3/8/2013 22:3    2013 03          8
        746779   42972331 1/4/2013 23:0    3/26/2013 21:50  2013 01         28
        746779   42972331 1/4/2013 23:0    3/26/2013 21:50  2013 02         28
        746779   42972331 1/4/2013 23:0    3/26/2013 21:50  2013 03         26
        763305   42972338 3/4/2013 22:19   3/6/2013 19:35   2013 03          3
    In the end the objective is to count the no. of days in each month between the arrival and discharge dates by Physician and for his/her patients.Then is the output above really what you want? Say you're interested in physician 763305. That physician had 18-patient days in March, 2013, but the output doesn't make it clear.
    I ran your query, it works great but I have a long list of patients for whom I have to run these counts.the query above includes all patient_ids.
    That's a separate problem, to be solved in the first sub-query, universe. The rest of the query will be unchanged.
    How will you know which patients to include? If you can derive the list from temp itself, just use a WHERE clause in universe. If you need to look at other tables, join them in universe, or use them in sub-queries in universe, or both.
    For exmple, if you decide that the list of patient_ids has no pattern, and that you'll need to store their ids in a separate table (perhaps a global temporary table), then universe might be:
    WITH     universe     AS
         SELECT     t.*     -- or list columns needed
         FROM     temp                        t
         JOIN     patient_ids_to_include  p 
                      ON  p.patient_id = t.patient_id
    ) ...The rest of the query can be the same as above.
    If a same patient is admitted again then Patient_ID will be different no matter when readmitted.Are you saying that patient_id identifies a visit, not a patient, and that the same person is assigned a different patient_id every time that person is admitted?
    For
    INSERT INTO temp (doctor_id, patient_id, arrive_dt_tm, disch_dt_tm)
    VALUES ( 755722
    , 42972229
    , TO_DATE ('03/14/2013 23:00', 'MM/DD/YYYY HH24:MI')
    , TO_DATE ('04/01/2013 12:00', 'MM/DD/YYYY HH24:MI')
    First the Patient ID will be different from the earlier admission. Second the results will show like:
    Doctor_ID     Patient_ID     ARRIVE_DT_TM     DISCH_DT_TM     Month     CountofDays
    755722     42972229     3/14/2013 23:00     4/1/2013 12:00     2012 03     14
    755722     42972229     3/14/2013 23:00     4/1/2013 12:00     2012 04     1Are you saying that temp.patient_id is unique, and so the situation is impossible?
    Edited by: Frank Kulash on May 7, 2013 10:23 AM

  • Line chart to plot count of 2 date fields against calendar month

    Post Author: springle
    CA Forum: Charts and Graphs
    I would like to create a line chart with 2 lines.  I would like the x axis to be a calendar month.  I would like the y axis to be the count of a date field for that month.  I would like 2 lines, one the the count of applications recieved in a month and the other to be the number of shipments in a month.  I can make a chart to plot one or the other but not both on one chart.So in summary I want of a count of date1 and a count of date2 by calendar month in one line chart.Thanks in advance,Scott

    Post Author: springle
    CA Forum: Charts and Graphs
    Thanks for the reply but I am afraid this does not solve my problem.  Your proposal make the month count of Date1 records in the fields and the count of Date2 in the month of date1 I am try to graph...In the month of Jan: 56 apps and 49 deliveriesIn the month of Feb: 76 apps and 79 deliveriesIn the month of Feb: 86 apps and 69 deliveriesThe change on date cannot be either app date or del date.  It needs to be independent from a calendar timeline. Scott 

  • Maintenance plans for Backward counter

    Is it possible for having a preventive maintenance plan for a measurement point that counts backwards?
    Your inputs on this will be appreciated!

    Help !
    I am looking for help with Counters and Timers and using them with a Maintenance Plan. We have about 10 count down timers mounted in one of our facilities. These timers are tied to the machine and measures the time until a mini or major PM will occur. These count down timers were previously used with the old CMMS system to assist in the scheduling of maintenance activities. We have recently converted them from the old CMMS to SAP PM but I am struggling with getting the count down timers to work in SAP. These timers are reset at 5000 hrs and as the machine operates, time is removed from the timer. A technician periodically reports these times to the system for scheduling purposes.
    I have created the Measurement Point for a Functional Location.
    I have identified that it is a counter.
    I have it identified that it Counts Backwards.
    When I try to assign this measurement point to a Maintenance Plan, I get the error "Only counters that run forwards can be entered"
    How can I use the countdown timers to create pre configured (PM) work orders?
    Thanks in advance.

  • How to get count for missing month

    I created a view as follows:
    CREATE OR REPLACE FORCE VIEW "Vinfection1" ("MONTH", "COUNT") AS
    select "MONTH","COUNT" from (
    select to_char(s.pdate,'Mon-yyyy') as month, count(*) as count
    from surproc s, diagnosis_surproc d
    where s.surprocid = d.surprocid and d.diagnosisid in ('506', '507', '508', '509', '510')
    group by to_char(pdate,'Mon-yyyy'))
    order by to_date(month,'Mon-yyyy')
    Some months are missing in the view. I want to put that month and 0 in the view. How to do it?
    Thanks,
    Jennifer

    Hi, Jennifer,
    You need to outer-join to some table or result set (such as all_months, below) that has one roe per month.
    Here's one way:
    CREATE OR REPLACE FORCE VIEW Vinfection1 (month, month_s, cnt) AS
    WITH    all_months     AS
         SELECT  ADD_MONTHS (first_month, LEVEL - 1)     AS month
         FROM     (
                  SELECT  TRUNC (MIN (pdate), 'MONTH')     AS first_month
                  ,         TRUNC (MAX (pdate), 'MONTH')     AS last_month
                  FROM    surproc
         CONNECT BY     LEVEL <= 1 + MONTHS_NETWEEN (last_month, first_month)
    SELECT  a.month
    ,     TO_CHAR (a.month, 'Mon-yyyy')     AS month_s
    ,     COUNT (*)                 AS cnt
    FROM              all_months      a
    LEFT OUTER JOIN      (     surproc               s
                   JOIN   diagnosis_surproc      d  ON   s.surprocid     = d.surprocid
                                          AND  d.diagnosisid     IN ('506', '507', '508', '509', '510')
               )     ON  a.month     = TRUNC (s.pdate)
    GROUP BY  a.month
    /Avoid table- and column names that are non-standatrd (such as names that need double-quotes), or are built-in function names (such as COUNT).
    Don't use ORDER BY in a view. Almost anything you do with the view will cause the ordering to be lost anyway.
    Even if you do have an ORDER BY clause in the view, you'll often want to ORDER BY month. Rather than call TO_DATE whenever you need to sort, I suggest having two month columns; month (whcih is a DATE) for sorting, filtering and joining, and month_s (whcih is a VARCHAR2) for displaying.
    Use ANSI join syntax, especiallly for outer joins.
    I hope this answers your question.
    If not, post a little sample data (CREATE TABLE and INSERT statements, relevant columns only) for all tables involved, and also post the results you want from that data.
    Explain, using specific examples, how you get those results from that data.
    Always say which version of Oracle you're using.
    Edited by: Frank Kulash on Mar 20, 2012 12:03 PM
    Added outer join condition

  • Count days per month

    dear members,
    I have been provided with the date range.
    i want to calculate the no. of days for each month, within the above date range.
    e.g. date1='10-01-2011' and date2='18-03-2011'
    for month=01 count days=22
    for month=02 count days=28
    for month=03 count days=18
    thanks
    teefu
    developer

    WITH     parameters     AS
         SELECT     TO_DATE ( '10-01-2011'
                   , 'DD-MM-YYYY'
                   )     AS start_dt
         ,     TO_DATE ( '18-03-2011'
                   , 'DD-MM-YYYY'
                   )     AS end_dt
         FROM     dual
    SELECT     TO_CHAR ( start_dt + LEVEL - 1
              , 'FMMonth YYYY'
              )     AS month
    ,     COUNT (*)     AS days
    FROM     parameters
    CONNECT BY     LEVEL <= 1 + end_dt - start_dt
    GROUP BY TO_CHAR ( start_dt + LEVEL - 1
              , 'FMMonth YYYY'
    ORDER BY MIN (LEVEL)
    duplicate thread already one has given the above answer
    count days of the month
    Edited by: LPS on Jul 21, 2011 2:16 AM

  • My counter's going backwards?

    Hey,
    I have been trying to create a 3-bit binary counter for a project and nothing seems to be going right. In fact it needs to be a divide by 6 counter, but I'll worry about that later.
    At the moment I have the design, but it likes to count backwards instead of forwards. I'm sure it will be quite simple, but I can't for the life of me figure out what's wrong.
    Thanks for any help you can give, I have attached the circuit below.
    Andy
    Attachments:
    3-Bit JK Counter2.ms10 ‏100 KB

    Alrighty, I got it. I am going to post the schematic for you to examine. What I did was to look at the component information in the component properties dialog box. After examining the truth table for the IC I found that in order to reset them that CLR had to be low and PRE had to be high. In the original circuit when I tied all these to high all three LEDs came on indicating that all the Q outputs were coming up defaulted high. My thought process that if I leave PRE High and take the Q ouputs and invert them and feed that back to CLR then a reset could be accomplished. Since all three of them were high this indicated that binary 7 was being displayed. How to reset this after 6? I tried tying in a nand gate to the outputs of the last 2 thinking that it would display 6 and then reset. That was wrong. It counted to 5 and then reset on 6. This clued me in on what needed to be done. If it was reseting on the number you selected then in order to display the number you selected then you need to reset after that number which in this case would be 7. I then tied a 3 input nand gate to all outputs and now it will count to six and reset them on 7. This will allso automatically reset them to zero on power up.
    I hope this helps. Here is the completed circuit:
    Message Edited by lacy on 03-08-2008 03:30 PM
    Kittmaster's Component Database
    http://ni.kittmaster.com
    Have a Nice Day
    Attachments:
    3-Bit Alternative JK Counter w_Reset.ms10 ‏115 KB

  • Month/Year reverse countdown help needed

    I need to create a simple reverse countdown that only needs
    the detail level of Months and Years. All of the tutorials I've
    found online are for counting down smaller intervals of time, like
    days, minutes, seconds, and milliseconds.
    I'm not very experienced with the code needed for such a
    timer, but essentially what I would like to have happen is:
    1. The current Month and Year are displayed onscreen.
    2. I click the mouse, and the Month and Year begin to count
    BACKWARDS, as if going back in time, so the Year would go from
    2007, to 2006, to 2005, etc, while the 12 months of the year would
    count down in reverse to coincide with the Year.
    3. When I click the mouse again, the countdown stops at
    whatever month/year it happens to be, I assume all the way back to
    the Year 0 if I let it play to the end.
    BONUS points if this reverse countdown could speed up over
    time, so that it appears to begin slowly, and rapidly speed up as
    the timer goes further back in time.
    Note that I do not need to use the ACTUAL date taken from the
    computer's clock, I'd be happy to just enter in, say "June 2007" as
    the start date and have it reverse from there. So even something
    that would just countdown from the numeral "2007" to "0" while a
    movieclip of the 12 months cycling along could work, though I have
    no concept as to how to control/increase the speed of such an
    animation as it plays.

    put the months in an array "december" to "january", and set a
    variable equal to the start year and an index that corresponds to
    the start month. display the start year/month.
    start a loop (setTimout would work) with a variable call
    frequency that calls a function that
    1. increases your array index (decreasing the year and
    restarting your index at 0 after the last array element is
    displayed) and displays the updated month/year
    2. decreases the variable call frequency and define another
    setTimeout.

Maybe you are looking for

  • Credit of Add Custom Duty in capital purchases at the time of J1iex

    Hello, As you all are aware that Indian law allows taking the 100 % credit of additional customs duty in case of capital procurement and only 50 % credit of CVD, Cess on CVD and S Ces s on CVD at the time of J1iex in first year itself We are facing t

  • IPhone and iTunes on a PC

    When I connect my iPhone to my PC, it doesn't come up in iTunes. When I plugged in my girlfriends, hers worked. How do I get iTunes it recognize my phone?

  • Cannot download secure websites after upgrading. (had to register using IE)

    I was having a lot of problems with secure websites, getting messages that secure connection failed. Finally got message to upgrade to latest version to solve the problem. Now I cannot access 'any secure website ( banking, credit card, store checkout

  • Accessing a coldfusion 8 developer server from the outside?

    I just installed Coldfusion 8 Developer edition with the built in server on a windows 7 computer on my home network because i want to experiment with some things for a client.  I can access the coldfusion pages from localhost but i cannot access them

  • Choosing language for movie in iTunes?

    Hello, I ripped a movie, from an original DVD I own, with two language tracks : English & French. When I play the movie with VLC, I can switch to english/french without problem. However, in iTunes, the French track is greyed out when I try to change