MONTHS_BETWEEN function returns 'wrong' negative values ???

Hi,
I can't figure out why these values are results.
SQL> select months_between(to_date('02-FEB-13','DD-MON-RR'), to_date('28-FEB-13','DD-MON-RR')) from dual;
MONTHS_BETWEEN(TO_DATE('02-FEB-13','DD-MON-RR'),TO_DATE('28-FEB-13','DD-MON-RR')
                                                                     -.83870968
SQL> select months_between(to_date('02-FEB-13','DD-MON-RR'), to_date('01-APR-13','DD-MON-RR')) from dual;
MONTHS_BETWEEN(TO_DATE('02-FEB-13','DD-MON-RR'),TO_DATE('01-APR-13','DD-MON-RR')
                                                                     -1.9677419
SQL> select months_between(to_date('02-FEB-13','DD-MON-RR'), to_date('02-APR-13','DD-MON-RR')) from dual;
MONTHS_BETWEEN(TO_DATE('02-FEB-13','DD-MON-RR'),TO_DATE('02-APR-13','DD-MON-RR')
                                                                             -2

Hi,
it could be worth also to mention a specific behavior of MONTHS_BETWEEN.
In case the 2 dates are on the same day on different month, the time portion is not considered and result is always an integer.
When the 2 dates are on different days then also the time portion in considered and the result is changing.
Here is an example:
alter session set nls_date_format='DD-MON-YYYY HH24:MI:SS';
select to_date('01-MAY-2013','dd-MON-yyyy') start_dt
     , to_date('31-MAY-2013','dd-MON-yyyy')+(level-1)*6/24 end_dt
     , months_between(to_date('01-MAY-2013','dd-MON-yyyy'), to_date('31-MAY-2013','dd-MON-yyyy')+(level-1)*6/24) diff
  from dual
connect by level <= 10
START_DT               END_DT                       DIFF
01-MAY-2013 00:00:00   31-MAY-2013 00:00:00   -0.9677419
01-MAY-2013 00:00:00   31-MAY-2013 06:00:00   -0.9758065
01-MAY-2013 00:00:00   31-MAY-2013 12:00:00   -0.9838710
01-MAY-2013 00:00:00   31-MAY-2013 18:00:00   -0.9919355
01-MAY-2013 00:00:00   01-JUN-2013 00:00:00           -1
01-MAY-2013 00:00:00   01-JUN-2013 06:00:00           -1
01-MAY-2013 00:00:00   01-JUN-2013 12:00:00           -1
01-MAY-2013 00:00:00   01-JUN-2013 18:00:00           -1
01-MAY-2013 00:00:00   02-JUN-2013 00:00:00   -1.0322581
01-MAY-2013 00:00:00   02-JUN-2013 06:00:00   -1.0403226
Regards.
Alberto

Similar Messages

  • MONTHS_BETWEEN function returning wrong negative values

    Hello all,
    The following is the query I am puzzling over:
    select to_char(sysdate,'dd-MON-yyyy') AS TODAY, TO_CHAR(HYPOTHETICAL_DATE, 'dd-MON-yyyy') AS HYPOTHETICAL_DATE,
    months_between(sysdate,HYPOTHETICAL_DATE) AS DIFF_IN_MONTHS from TableX
    My result is:
    TODAY HYPOTHETICAL_DATE DIFF_IN_MONTHS
    21-MAR-2012     10-JUL-2020     -99,63109505675029868578255675029868578256
    I am puzzled since in this case since the 2nd date is 8 years down the line my difference should be -8 and a fraction. So why am I getting -99?
    Furthermore I would like to ignore the fractional part so the result I want for the above data is -8.
    Please help.
    Thanks
    S. BASU

    The name of the function is MONTHS_BETWEEN and not YEARS_BETWEEN. So the result is correct!
    Perhaps you are looking for something like:
    select trunc(months_between(sysdate,to_date('10.07.2020'))/12) from dual;or
    select round(months_between(sysdate,to_date('10.07.2020'))/12) from dual;TRUNC cuts the fraction and ROUND rounds it. For example it would be a difference for -8.7.
    Edited by: hm on 21.03.2012 02:42

  • SXPG_COMMAND_EXECUTE  return wrong parameter value

    Dear all.
    We have an Abap program that pulls an encrypted FTP file and saves it to our network.
    After that we activate an external command via transaction SM69 by calling FM SXPG_COMMAND_EXECUTE.
    This command is an execution of a batch file that executes a decryption method via PGP decryption software.
    The problem is that we get an output parameter of this FM (STATUS) as u201CEu201D (error) although the decryption is being executed successfully.
    We have the same process being activated same way successfully with another folders (rest is exactly the same).
    Why does SXPG_COMMAND_EXECUTE return wrong status value ?
    Regards,
    Rebeka

    SXPG_COMMAND_EXECUTE runs under certain operating system user account. Looks like that account does not have enough privileges to do what you want it to do. Look at the operating system for privileges (read,write,execute) of the user account SAPServiceuser or equivalent.
    /Simo

  • Why does getdate() function return same time value for multiple select statements executed sequentially

    When I run the following code
    set nocount on
    declare @i table(id int identity(1,1) primary key, sDate datetime)
    while((select count(*) from @i)<10000)
    begin
    insert into @i(sDate) select getdate()
    end
    select top 5 sDate, count(id) selectCalls
    from @i
    group by sDate
    order by count(id) desc
    I get the following results. 
    sDate                   selectCalls
    2014-07-30 14:50:27.510 406
    2014-07-30 14:50:27.527 274
    2014-07-30 14:50:27.540 219
    2014-07-30 14:50:27.557 195
    2014-07-30 14:50:27.573 170
    As you can see the select getdate() function returned same time up to the milisecon 406 time for the first date value.  This started happening when we moved our applications to a faster server with four processors.  Is this correct or am I
    going crazy?
    Please let me know
    Bilal

    Observe that adding 2 ms is accurate only with datetime2.  As noted above, datetime does not have ms resolution:
    set nocount on
    declare @d datetime, @i int, @d2 datetime2
    select @d = getdate(), @i = 0, @d2 = sysdatetime()
    while(@i<10)
    begin
    select @d2, @d, current_timestamp, getdate(), sysdatetime()
    select @d = dateadd(ms,2,@d), @i = @i+1, @d2=dateadd(ms,2,@d2)
    end
    2014-08-09 08:36:11.1700395 2014-08-09 08:36:11.170 2014-08-09 08:36:11.170 2014-08-09 08:36:11.170 2014-08-09 08:36:11.1700395
    2014-08-09 08:36:11.1720395 2014-08-09 08:36:11.173 2014-08-09 08:36:11.170 2014-08-09 08:36:11.170 2014-08-09 08:36:11.1700395
    2014-08-09 08:36:11.1740395 2014-08-09 08:36:11.177 2014-08-09 08:36:11.170 2014-08-09 08:36:11.170 2014-08-09 08:36:11.1700395
    2014-08-09 08:36:11.1760395 2014-08-09 08:36:11.180 2014-08-09 08:36:11.170 2014-08-09 08:36:11.170 2014-08-09 08:36:11.1700395
    2014-08-09 08:36:11.1780395 2014-08-09 08:36:11.183 2014-08-09 08:36:11.170 2014-08-09 08:36:11.170 2014-08-09 08:36:11.1700395
    2014-08-09 08:36:11.1800395 2014-08-09 08:36:11.187 2014-08-09 08:36:11.170 2014-08-09 08:36:11.170 2014-08-09 08:36:11.1700395
    DATE/TIME functions:
    http://www.sqlusa.com/bestpractices/datetimeconversion/
    Kalman Toth Database & OLAP Architect
    SQL Server 2014 Design & Programming
    New Book / Kindle: Exam 70-461 Bootcamp: Querying Microsoft SQL Server 2012

  • Revaluate function using a negative value in the revaluation variable

    Hello,
    I'm trying to use the revaluate function in IP, using a user defined variable containing a negative value, I have a error that tells me that the value in the variable is incorrect.
    I've tried several syntaxes, including "-10" or "10-" to revaluate the ratios at 90% of their original values, but without otaining any success.
    Has somebody an idea ?
    Regards,
    Mickael

    Hi Michael,
    we noticed the same and we created a simple FOX formula for this. This works fine then
    (One should use values like 0,5 I guess to devaluate which is not user friendly)
    D
    For example:
    DATA LV_REVALUATION TYPE F.
    LV_REVALUATION = VARV(Z_REVALUATION).
    = * (1 + ( LV_REVALUATION / 100)).
    (Z_REVALUATION is a variable type formula.)

  • Why does the cell style index returning wrong CellFormat value when parsing excel cells using OpenXml SDK?

    Consider a General format cell having a value of 39.95. When I fetch the CellFormat of the cell it returns wrong cell format-
    CellFormat thisCellFormat = ((CellFormat)cellFmts.ChildElements[(int)thisCell.StyleIndex.Value]);
    int fmtId = Convert.ToInt32(thisCellFormat.FormatId.Value);
    The value of fmtId returned is 1, and in some cases 38, where it should be 2 or 39.
    This issue is only for General format cells, I am getting correct id for Number format cells.
    Below is the
    Standard ECMA-376 Office Open XML File Formats specified set of implied cell formats for reference-
    ID Format Code
    0 General
    1 0
    2 0.00
    3 #,##0
    4 #,##0.00
    9 0%
    10 0.00%
    11 0.00E+00
    12 # ?/?
    13 # ??/??
    14 mm-dd-yy
    15 d-mmm-yy
    16 d-mmm
    17 mmm-yy
    18 h:mm AM/PM
    19 h:mm:ss AM/PM
    20 h:mm
    21 h:mm:ss
    22 m/d/yy h:mm
    37 #,##0 ;(#,##0)
    38 #,##0 ;Red
    39 #,##0.00;(#,##0.00)
    40 #,##0.00;Red
    45 mm:ss
    46 [h]:mm:ss
    47 mmss.0
    48 ##0.0E+0
    49 @

    The purpose of this forum is to support the Open Specifications documentation. You can read about the Microsoft Open Specifications program here,
    http://www.microsoft.com/openspecifications/en/us/default.aspx
    The library of Open Specification documents is located here,
    http://msdn.microsoft.com/en-us/library/dd208104.aspx
    It doesn’t appear that you are implementing one of the protocols cited.  Your question may be more applicable to MSDN's Microsoft Office for Developers/Open XML Format SDK forum at
    https://social.msdn.microsoft.com/Forums/office/en-US/home?forum=oxmlsdk
    Bryan S. Burgin Senior Escalation Engineer Microsoft Protocol Open Specifications Team

  • FM returns wrong total value for Limit type PO's

    Hi all,
    I am working on SRM 5.0 (SP13) ECS.
    I have implemented the BADI "BBP_WFL_APPROVAL_BADI" for determining the Approvers for PO whenevr a PO is changed.If the diference between the Old PO value and new PO value is > 1000 and the approval text field(custom text under "Documents" link) is set to "YES",then the WF approval is required and the approvers are determined.
    The above logic works fine for the Standard type PO's where the difference between the old value and new value is determined using FM "BBP_PD_PO_GETDETAIL"  by passing the GUID (for the change version and the active vesion) obtained at runtime in the BADI.
    However for the limit type PO's,whenevr I change the total value for the Limit item,I see that the FM "BBP_PD_PO_GETDETAIL" doesnt return the changed value but  always returns blank!
    Bcause I need to check bth the values i.e. Custom text set to "YES" as well as Total value diff ,I cant use the start conditions in tcode SWB_COND.ALso I need to fetch the approvers based on the price diff so I need this value at runtime in the BADI using the FM "BBP_PD_PO_GETDETAIL".
    Please advise why the FM is not returning the changed values for the Limit type PO and is there any other way(other table/FM) to get the changed value at runtime for the LIMIT type PO.
    Thanks for your time.
    Edited by: Rads1234 on Nov 18, 2010 4:39 AM

    Thanks for the rpely.
    Yes.I am using the GUID available at runtime in the  BADI "BBP_WFL_APPROV_BADI" which is the current change version GUID.I tried using that GUID to get the data from both FM as well as CDHDR and CDPOS tables.
    I think this is something related to LImit type PO because for Standard type PO's the FM returns the corretc changed value (as in the screen) for the change version GUID.I fail to understand why the changed values are shwon on the screen but are not stored anywhere in the system before actually ordering the PO!

  • NODIM function Returns wrong values?

    Hi All,
    We have a KF Quantity in PC and  we are using NODIM(Quantity) to diaply it without units.But
    NODIM(Quantity) displays wrong results.
    For Example:Quantity = 3123214 PC     and NODIM(Quantity) = 3123214.123
    What could be the reason for it?can anyone explain me?
    Thanks
    Message was edited by: Murli

    Thanks for your wishes on the other post.
      My advance wishes to you for the same..
    Dear Murali,
    I am not sure the following 'note' can help us.. please have a look..
    Note number: 604857: ( Also have a look at 590089,730382)
    Incorrect number of decimal places with NODIM operator
    Symptom
    The system produces an incorrect proposal for the number of decimal places for a structure element.
    Other terms
    Query, NODIM, decimals, decimal places
    Reason and Prerequisites
    The key figure uses the NODIM operator
    Solution
    BW 3.0B
               Import Support Package 12 for 3.0B (BW 3.0B Patch 12 or SAPKW30B12) into your BW system. This Support Package will be available when note 523249 with the short text "SAPBWNews BW 3.0B Support Package 12", which describes this Support Package in more detail, is released for customers.
                To provide information in advance, note 523249 may already be available before the Support Package is released. In this case, the short text will still contain the words "preliminary version".
    BW 3.1C
               Import Support Package 06 for 3.1C (BW 3.1C Patch06 or SAPKW31C06) into your BW system. This Support Package will be available when note 539827 with the short text "SAPBWNews BW 3.1C Support Package 06", which describes this Support Package in more detail, is released for customers. For more information on BW Support Packages, see note 110934.
    In urgent cases, you can implement the correction instructions in your system using transaction SNOTE.
    Regards,
    Hari
    Message was edited by: Hari Kiran Y

  • [HELP] AGO function return wrong result

    Hi, i try to implement ago function in OBIEE, but the result is not as expected. Please help me to configure Time Dimension to get this work.
    My case:
    - I have a time dimension with this configuration:
    [http://i264.photobucket.com/albums/ii176/necrombi/NEO/1-1.png]
    Time Hierarchy: Total > Year > Quarter > Month > Day
    Year:
    Primary key: Calendar_year_cal_year_code
    Chronological key: Does not define
    Quarter:
    Primary key: Calendar_quarter_description
    Chronological key: Does not define
    Month:
    Primary key: Calendar_month_description
    Chronological key: Calendar_month_description
    Day:
    Primary key: Dimension_key
    Chronological key: Day_day_code
    My ago function: AGO(expression, mywh.D_qn_thoigianDim."month", 1)
    I do not understand why i get this wrong results:
    [http://i264.photobucket.com/albums/ii176/necrombi/NEO/2.png]
    Does anyone know how to solve this?
    Edited by: 864451 on Jun 8, 2011 5:11 AM

    Hi, thanks for your reply.
    I implemented Time dimension with your recommend, and have time dimension like this:
    Time Hierarchy: Total > Year > Quarter > Month > Day
    Year:
    Primary key: Calendar_year_start_date
    Chronological key: Calendar_year_start_date
    Quarter:
    Primary key: Calendar_quarter_start_date
    Chronological key: Calendar_quarter_start_date
    Month:
    Primary key: Calendar_month_start_date
    Chronological key: Calendar_month_start_date
    Day:
    Primary key: Day
    Chronological key: Dimension_key
    And Ago function works fine with month level: AGO(expression, mywh.D_qn_thoigianDim."month", n)
    But return sum result of 12 month with: AGO(expression, mywh.D_qn_thoigianDim."year", 1)
    In my case, i just use AGO(expression, mywh.D_qn_thoigianDim."month", 12) to get year ago value. But i still don't understand clearly about OBIEE Time Serries functions.
    Thanks,
    Dung Nguyen

  • HTMLDB_ITEM.SELECT_LIST function returns wrong result in 1.6?

    Look at following select statements:
    1. select flows_010600.htmldb_item.select_list(1,null,'Full;F,Read;R,No;N',
    '','YES',null,'Derived','f01_'||TO_CHAR(ROWNUM,'FM0000'),'D')
    from dual
    &lt;label for="f01_0001" class="hideMe508"&gt;D&lt;/label&gt;&lt;select name="f01" id="f01_0001"&gt;&lt;option value=""&gt;Derived&lt;/option&gt;&lt;option value="F" &gt;Full&lt;/option&gt;&lt;option value="R" &gt;Read&lt;/option&gt;&lt;option value="N" &gt;No&lt;/option&gt;&lt;option value="" selected="selected"&gt;&lt;/option&gt;&lt;/select&gt;
    2.select flows_010500.htmldb_item.select_list(1,null,'Full;F,Read;R,No;N',
    '','YES',null,'Derived','f01_'||TO_CHAR(ROWNUM,'FM0000'),'D')
    from dual
    &lt;label for="f01_0001" class="hideMe508"&gt;D&lt;/label&gt;&lt;select name="f01" id="f01_0001"&gt;&lt;option value=""&gt;Derived&lt;option value="F" &gt;Full&lt;option value="R" &gt;Read&lt;option value="N" &gt;No&lt;/select&gt;
    If selected value of list is null version 1.6 call adds extra item without display value. Version 1.5 call works fine. Is it a bug or implied behavior?

    Hi Alexey,
    This is the intended behavior; in your htmldb_item.select_list call, you are setting the current value to NULL. This is the value shown in 1.6. In 1.5 the first value from your list of values was shown. This behavior wasn't appropriate in most cases. If for example you had a tabular form with a select list and the values retrieved from the database were not part of the list of values used for the select list, it would basically default the select list to the first value from your list of values. If you then saved your tabular form, you would have ended up with the wrong data. Now the select list will show the actual value from the database, if it's not part of the list of values. Otherwise it will show the correct display value. If in your case this is not the behavior you need, you can simply turn that off by modifying your query to:
    select flows_010600.htmldb_item.select_list(1,null,'Full;F,Read;R,No;N',
    '','YES',null,'Derived','f01_'||TO_CHAR(ROWNUM,'FM0000'),'D','NO')
    from dual
    I simply added another attribute which is called p_show_extra and set it to 'NO'. Here's the full specification of the function:
    function select_list (
    p_idx in number,
    p_value in varchar2 default null,
    p_list_values in varchar2 default null,
    p_attributes in varchar2 default null,
    p_show_null in varchar2 default 'NO',
    p_null_value in varchar2 default '%null%',
    p_null_text in varchar2 default '%',
    p_item_id in varchar2 default null,
    p_item_label in varchar2 default null,
    p_show_extra in varchar2 default 'YES'
    ) return varchar2
    Hope this helps,
    Marc

  • JTable.getSelectedRow seems to return wrong index value in J2SDK 1.4

    OS version: Microsoft Windows 2000 [Version 5.00.2195]
    JDK version: J2RE, Standard Edition (build 1.4.2_07-b05)
    I have a pretty simple JTable in which when a user selects a particular value in the first column of a row, the remainder of the columns in that row are populated with text values. The way we tell the JTable which row to populate the column values for is via the getSelectedRow() method. This worked fine using 1.3.1.08. However, when we upgraded to 1.4.2.07, we get an ArrayIndexOutOfBoundsException thrown because for some reason the getSelectedRow method returns the wrong value (e.g. if the user selects the first row, instead of returning an index of 0, the method returns an index of 2, even if there is only 1 row in the table, thus the out-of-bounds). The code has not changed at all -- all we have done is upgrade the version of the JDK. I have seen similar issues on various postings on the web, but these all have to do with removing rows and the like, and having to cancel or stop cell editing before removing the row(s). However, this does not apply in my case, so I think this might be a new bug. Before I post all kinds of code, does anybody know if this is a known bug and/or is there a workaround?
    Here is my stack trace:
    In Thread[AWT-EventQueue-0,6,main]
    caught java.lang.ArrayIndexOutOfBoundsException: 2 >= 2
         at java.util.Vector.elementAt(Vector.java:431)
         at javax.swing.table.DefaultTableModel.setValueAt(DefaultTableModel.java:633)
         at com.sra.kdd.tools.view.NtwrkDefnVW.propertyChange(NtwrkDefnVW.java:475)
         at java.beans.PropertyChangeSupport.firePropertyChange(PropertyChangeSupport.java:330)
         at java.beans.PropertyChangeSupport.firePropertyChange(PropertyChangeSupport.java:257)
         at com.sra.kdd.tools.model.NtwrkSourceDSMDL.setDsNM(NtwrkSourceDSMDL.java:298)
         at com.sra.kdd.tools.view.NtwrkCTRL.handleSourceTableEvent(NtwrkCTRL.java:464)
         at com.sra.kdd.tools.view.NtwrkCTRL.tableChanged(NtwrkCTRL.java:120)
         at javax.swing.table.AbstractTableModel.fireTableChanged(AbstractTableModel.java:280)
         at javax.swing.table.AbstractTableModel.fireTableCellUpdated(AbstractTableModel.java:259)
         at javax.swing.table.DefaultTableModel.setValueAt(DefaultTableModel.java:635)
         at javax.swing.JTable.setValueAt(JTable.java:1794)
         at javax.swing.JTable.editingStopped(JTable.java:3167)
         at javax.swing.AbstractCellEditor.fireEditingStopped(AbstractCellEditor.java:124)
         at javax.swing.DefaultCellEditor$EditorDelegate.stopCellEditing(DefaultCellEditor.java:329)
         at javax.swing.DefaultCellEditor$3.stopCellEditing(DefaultCellEditor.java:139)
         at javax.swing.DefaultCellEditor.stopCellEditing(DefaultCellEditor.java:214)
         at javax.swing.DefaultCellEditor$EditorDelegate.actionPerformed(DefaultCellEditor.java:346)
         at javax.swing.JComboBox.fireActionEvent(JComboBox.java:1197)
         at javax.swing.JComboBox.setSelectedItem(JComboBox.java:561)
         at javax.swing.JComboBox.setSelectedIndex(JComboBox.java:597)
         at javax.swing.plaf.basic.BasicComboPopup$ListMouseHandler.mouseReleased(BasicComboPopup.java:749)
         at java.awt.AWTEventMulticaster.mouseReleased(AWTEventMulticaster.java:232)
         at java.awt.Component.processMouseEvent(Component.java:5100)
         at javax.swing.plaf.basic.BasicComboPopup$2.processMouseEvent(BasicComboPopup.java:452)
         at java.awt.Component.processEvent(Component.java:4897)
         at java.awt.Container.processEvent(Container.java:1569)
         at java.awt.Component.dispatchEventImpl(Component.java:3615)
         at java.awt.Container.dispatchEventImpl(Container.java:1627)
         at java.awt.Component.dispatchEvent(Component.java:3477)
         at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:3483)
         at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3198)
         at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3128)
         at java.awt.Container.dispatchEventImpl(Container.java:1613)
         at java.awt.Window.dispatchEventImpl(Window.java:1606)
         at java.awt.Component.dispatchEvent(Component.java:3477)
         at java.awt.EventQueue.dispatchEvent(EventQueue.java:456)
         at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:201)
         at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:151)
         at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:145)
         at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:137)
         at java.awt.EventDispatchThread.run(EventDispatchThread.java:100)
    I do have a workaround -- this is definitely not a recommended workaround whatsoever, but it's what I've done just to get by for now, so I thought it might possibly shed some light into the problem. It seems that the index is always off by 2, so I just subtract 2 from the result of getSelectedRow() and then everything works just fine.
    Any ideas? Thank you!

    If I remember correctly there was a big change in the focus subsystem between JDK1.3 and JDK1.4
    Before I post all kinds of code,...Write a 10 line demo program that shows this behaviour. We aren't interested in all kinds of code. If you can't duplicate the problem in 10 lines of code, then the problem is with the rest of your code. So compare you demo code to see why its working and your current code to see why its not working.

  • On 64bit iOS 8.1 simulator, Why BOOL type function return a unexpected value?

    Code example:
    ------func.h------
    #import <Foundation/Foundation.h>
    @interface func : NSObject
    + (id)instance;
    @end
    ------func.m------
    #import "func.h"
    @implementation func
    + (id)instance
         static func *obj = nil;
         if (obj == nil) {
              obj = [func new];
         return obj;
    - (BOOL)test
         return YES;
    @end
    I created a new class "func" in project as above shown, set the project compile scheme to "release" mode.
    I found that if I call  [func test] method from another class, its return value is not "1" on iPhone6 simulator, it is a random value. Why?
    PS: I can not find this problem on iPhone6 device, it seems only happen on 64 bit simulator. Why?

    Your main problem as etresoft points out, is that your trying to use -test as a class method, you'll need to declare it as:
    +test { ... }
    for this to work. -test and +test are two different kinds of methods, -test needs a instance of 'func' to work:
    func *f = [[func alloc] init]; // create instance f of func
    [f test]; // calls -test, -test can use f as self
    while +test needs a class (name):
    [func test]; // calls +test
    Class methods are mainly used for creating/initiating instances of a class, the +init method is a typical example of this, other uses are are for utility methods that may not really be tied to a specific object (class instance). Also note that a class method doesn't have access to self as it wasn't called on an object, so data will need to be passed in via parameters or by using global variables.
    ===============
    dispatch_once() is the recommended way to do singletons, although the above will typically work assuming that its not accessed by multiple threads, e.g. is only used on the main thread.
    ===============
    This page http://www.bignerdranch.com/blog/bools-sharp-corners/ appears to relate to etrsofts dislike for BOOL (the standard boolean type of Objective-C) and his preference for bool (the C++ variant), but as the page mentions: "Update October 2013 - On 64-bit iOS (device and simulator) BOOL is now actually bool, so the sharp corners have thankfully gone away for that platform. For everything else, though…"

  • Can a function return two values???

    Hi guys can a function return more than values?

    Or even better return an Object.
    ie
    public class Tester{
         public static Multi getM()
              Multi m=new Multi();
              m.x="testing";
              m.y="new value";
         public static void main(String [] args)
              Multi mt=getM();
              System.out.println(mt.x);
              System.out.println(mt.y);
         class Multi{
              public String x;
              public String y;
    }

  • PercentLoaded returns negative value

    Hi there,
    I use some javascript on the website I'm working on to check if a swf file is loaded. I use the PercentLoaded method like explained here How should I judge that the flash has been loaded completed
    It works well except that sometimes the file loads until 50-70% and then PercentLoaded starts to return negative values. This seems to only happen with really large swf files, usually bigger than 30MB.
    Is there a reason to that? Is it a known issue? Is there a workaround?
    Thanks!

    Hello!
    We have the same issue.
    In our case the swf that is returning a negative value is 20Mb.
    Any solution/workaround?
    Thanks!

  • One LIFNR, based on a function can send multiple values to traget.

    Dear SDNers,
    I need your help to solve this problem…
    Let me explain the situation.
    I have a field value “LIFNR”, which is sending a value from the source to target.
    Here by using a User Define Function based on parameters I have to map the exact target.
    The problem is:
    Currently I am having a function which is sending  a value to the target based on parameters and some times the target values are more that a single value. At that situation the function returns a random value to the target value.
    In the below Old Function there is a method used to execute only one value, if more than one values are there then it will select a random value from them and send that value to the destination.
    IFIdentifier src = XIVMFactory.newIdentifier(strContext, senderAgency, senderScheme);
    IFIdentifier dst = XIVMFactory.newIdentifier(strContext, receiverAgency , receiverScheme);
    String strResult = XIVMService.executeMapping(src, dst, a);
    Solution as in New Function,
    I have created a array to that particular destination variable and stored all value in array and passed to that target value. I have bold that letters.
    //here I run a loop to store multiple destination value
    if(receiverService.length>1)
    for(i=0;i<receiverService.length;i++)
    if (receiverService.equals("EM1CLNT003")||receiverService.equals("KM1CLNT003")||receiverService.equals("C11CLNT003")) receiverAgency<i> = "C11CLNT003";
    I am sending both the functions
    My question is is that LIFNR can send the multiple values to the detination for this change ?
    And also I want to know how to execute this program and transport and testing this UDF.
    Please need your inputs.
    Thanks
    Bala Prasad
    4. Old Function
    java.util.regex.Pattern;java.util.Vector;java.util.regex.Matcher;com.sap.aii.mapping.value.api.*;
    public String get_Value_Mapping_Table_V(String a,String scheme,String context,Container container){
    // PART1 : First we need to get the sender - and receiver service from the container object
    GlobalContainer globalContainer;
    String senderService = new String();
    String receiverService = new String();
    java.util.Map map;
    //Fill variables
    globalContainer = container.getGlobalContainer();
    map = globalContainer.getParameters();
    // Get the sender- and receiver service constants
    senderService = (String) map.get(
    StreamTransformationConstants.SENDER_SERVICE);
    receiverService = (String) map.get(
    StreamTransformationConstants.RECEIVER_SERVICE);
    // PART2: Now we need to find the correct value mapping table
    String strContext = context;                                //some context value
    String senderScheme = scheme;                                    //VendorNumber or VendorAccountGroup
    String receiverScheme = scheme;
    String receiverAgency = new String();
    if (receiverService.equals("EL1CLNT100")||receiverService.equals("KL1CLNT100")||receiverService.equals("PL1CLNT100")) receiverAgency = "PL1CLNT100";
    if (receiverService.equals("D01CLNT100")||receiverService.equals("T01CLNT100")||receiverService.equals("P01CLNT100")) receiverAgency = "P01CLNT100";
    if (receiverService.equals("EM1CLNT003")||receiverService.equals("KM1CLNT003")||receiverService.equals("C11CLNT003")) receiverAgency<i> = "C11CLNT003";
    String senderAgency =  "MEPCLNT100";
    IFIdentifier src = XIVMFactory.newIdentifier(strContext, senderAgency, senderScheme);
    IFIdentifier dst = XIVMFactory.newIdentifier(strContext, receiverAgency , receiverScheme);
                try {
                            String strResult = XIVMService.executeMapping(src, dst, a);
                            return strResult;
                } catch (ValueMappingException e) {
                            return a;
    5. New Function
    java.util.regex.Pattern;java.util.Vector;java.util.regex.Matcher;com.sap.aii.mapping.value.api.*;
    public String get_Value_Mapping_Table_N(String a,String scheme,String context,Container container){
    // PART1 : First we need to get the sender - and receiver service from the container object
    GlobalContainer globalContainer;
    String senderService = new String();
    String receiverService = new String();
    java.util.Map map;
    //Fill variables
    globalContainer = container.getGlobalContainer();
    map = globalContainer.getParameters();
    // Get the sender- and receiver service constants
    senderService = (String) map.get(
    StreamTransformationConstants.SENDER_SERVICE);
    receiverService = (String) map.get(
    StreamTransformationConstants.RECEIVER_SERVICE);
    // PART2: Now we need to find the correct value mapping table
    String strContext = context;                                //some context value
    String senderScheme = scheme;                                    //VendorNumber or VendorAccountGroup
    String receiverScheme = scheme;
    String receiverAgency[] = new String(); //here I changed into a array to store multiple value
    if (receiverService.equals("EL1CLNT100")||receiverService.equals("KL1CLNT100")||receiverService.equals("PL1CLNT100")) receiverAgency = "PL1CLNT100";
    if (receiverService.equals("D01CLNT100")||receiverService.equals("T01CLNT100")||receiverService.equals("P01CLNT100")) receiverAgency = "P01CLNT100";
    //here I run a loop to store multiple destination value
    if(receiverService.length>1)
    for(i=0;i<receiverService.length;i++)
    if (receiverService.equals("EM1CLNT003")||receiverService.equals("KM1CLNT003")||receiverService.equals("C11CLNT003")) receiverAgency<i> = "C11CLNT003";
    }String senderAgency =  "MEPCLNT100";
    IFRequest src = XIVMFactory.newIFRequest(strContext,senderAgency,senderScheme);
    IFRequest dst = XIVMFactory.newIFRequest(strContext,receiverAgency,receiverScheme);
                try {
                            String strResult = XIVMService.executeMapping(src, dst, a);
                            return strResult;
                } catch (ValueMappingException e) {
                            return a;

    Janaki,
    "and it did not work."
    That's useless information.
    When asking for help with a technical question here, you need to describe exactly what you did, showing all code, explaining the entire context in which the code is used, and showing all error messages and actual results along with a description of the expected results.
    One thing though, if this example is based on the standard EMP table, why does "depno" have no "t" in it in all your references?
    Scott

Maybe you are looking for

  • Need some help please, itunes 7.1 and Windows Vista

    Hello, I've got a bit of a problem here with itunes and my ipod nano. Basically I'm using Windows Vista Ultimate 32bit and when I connect my ipod to my PC the found new hardware wizard pops up but can never find the ipod nano. In disk management the

  • My Iphone 5 is not showing up in my devices on Itunes and there is no option to sync.

    My Iphone 5 does not show up in devices when I plug into my computer. No devices show up. I was getting a small box that showed the Iphone and wanted me to open it to view the files, which basically shows how much space is left. I tried draggin a pla

  • Run Query report showing only PO block item, yet to be received.

    Hi, Out GR process involves putting the material in (PO block) first using the movement type 903 and t-coden MB0. Next step is GR in unrestricted use using  M Type 905 and t-code MB01 as well. I have to enhance a query report so that only those items

  • Car Charger that fits Otter Box?

    Does anyone use the super tank-like otter box case for the 3GS and if so, what do you use to charge your phone in the car? The few i've bought and taken back won't fit unless you take the phone clear out of the case.. and if you have one of these, ho

  • For those whose safari always crashes - remove adware

    Save the lengthy stack trace. When browser crashes, it often means that the data or plugin that safari try to load cause the failure.  Think safari as a container who tries to accommodate plug-in or extensions such as adobe flash player. So the very