Automatic type conversion

Hi everyone,
I am a newbie at flex and I was trying to write a small
program which calls a .NET web service which returns the
information in a xml format and the XML is returned to the Flex
method. everything works fine but sometimes when the Data contains
something like 122345E104, Flex converts this data into a numerical
value automatically, because of the "E" it thinks it is an
Exponential symbol. How can I prevent this from happenning.
Eg if the data returned from the web service is as following
<securityMasterByCusipResponse xmlns="
http://abc.com/RSSXSD/">
<securityMasterByCusip>
<masterList>
<cusip>26144E101</cusip>
<price>0.068</price>
<symbol>DRGG</symbol>
<securityName>DRAGON INTL GROUP</securityName>
</masterList>
</securityMasterByCusip>
</securityMasterByCusipResponse>
I have a method like this to read the data which is called as
a callback to the aysnchronous web service call
public function result(data:Object):void
var contentObject:Object =
data.result.securityMasterByCusipResponse.securityMasterByCusip.masterList;
cusipText.Text = Object.cusip; // this returns
2.61440000000000e+105 instead of 26144E101
Please help me to resolve this issue.
Thanks in advance
Regards
Vikram

Hi vikramswami,
Try to use the single quotes around that field...you can try this work around...
Check the below xml...the tag in bold...I have used single quotes around the value...so that it will be treated as a string instead of a numeric...
<securityMasterByCusipResponse xmlns=" http://abc.com/RSSXSD/">
<securityMasterByCusip>
<masterList>
<cusip>'26144E101'</cusip>
<price>0.068</price>
<symbol>DRGG</symbol>
<securityName>DRAGON INTL GROUP</securityName>
</masterList>
</securityMasterByCusip>
</securityMasterByCusipResponse>
So you need to strip the quotes while displaying the value in the Flex label or Text ...since we have appended these quotes in xml...
var contentObject:Object = data.result.securityMasterByCusipResponse.securityMasterByCusip.master List;
model.cusip = Object.cusip; //This Model is used by the User
model.cusip = model.cusip.substring(1,model.cusip.length-2); 
Note: model.cusip variable should be a String datatyped variable...
Hope this helps in resolving your problem.,..
If this post answers your question or helps, please kindly mark it as such.
Thanks,
Bhasker Chari

Similar Messages

  • What are Automatic type conversion rules ?

    Please list out the rules that govern automatic type conversion.

    Hi Albert,
    Check the SAP help at:
    http://help.sap.com/saphelp_47x200/helpdata/EN/fc/eb3427358411d1829f0000e829fbfe/frameset.htm
    Regards,
    Arjan

  • JSP type conversion (JSP- PageBean) not working

              We are using page beans extensively, and I had expected that if you have a variable
              of type String passed in the URL (variable name is "id" for example, a unique record
              identifier), and within the page bean declaration you have a setId(int uId){...}
              that the JSP engine will automatically do the type conversion between the String
              and the int.
              I am using WLS6.0 on NT4.0SP5, and whenever I do this I get a
              java.lang.NoSuchMethodError error.
              When I change the method signature to setId(String uId){...} (and change the variable
              types etc. and do the String to int conversion myself), all works fine.
              Does WLS6.0 not support this automatic type conversion?
              Thanks in advance,
              Mils.
              

    Try removing the transient property.
    To avoid the duplicate problem, verify, before creating the component if the component is already on the tree.
    transient - A flag indicating whether this instance has
    decided to opt out of having its state
    information saved and restored. The
    default value for all standard component,
    converter, and validator classes that
    implement StateHolder must be false.
    By other words -
    � void setTransient(boolean newValue)
    � boolean isTransient()
    Set and get the transient property. When this property is set, the state is not
    saved.

  • Automatic time conversion is not possible

    Hi Friends,
    I have a problem in Transformation Level when i am mapping "automatic time conversion is not possible for source field FISCPER to 0FISCYEAR,FISCPER3".can any one help me in this issue.
    Thanks
    Narasimha

    Yes if it was date filed then it would have been possible.If you are trying to derive the fiscal year between datasource and cube then you can get it with the help of simple filed level routine.
    Map your fiscper field from source to fiscal year--Rule type Routine.
    RESULT = SOURCE_FIELDS-(Technical name of source field)+0(4).
    For Posting period
    Map your fiscper field from source to fiscper3 year--Rule type Routine.
    RESULT = SOURCE_FIELDS-(Technical name of source field)+4(3).
    This will give you the required output.
    Regards,
    AL

  • How to suppress automatic keyfigure conversion in WD ALV?

    Dear experts,
    I am having a problem with automatic input conversion in WD ALV.
    I have a key-figures (type P length 9, decimals 2)in my ALV which has reference field of type if_salv_wd_c_field_settings=>reffieldtype_curr.
    I process the changes by event ON_DATA_CHANGE which passes this change object:
    r_param->t_modified_cells
    r_param->t_inserted_rows
    r_param->t_deleted_rows
    r_param->t_error_cells
    The thing is that the changes in table r_param->t_modified_cells are already converted into internal format. When user enters "1", I get here in this table value "1.00". But this internal value is not always correct because corresponding reference field with currency key may not be known yet (it is calculated later on background from other fields).
    Therefore, for example for currency JPY which has no decimal places external value "1" is converted into wrong internal value "1.00" (the correct internal value is "0.01").
    Therefore, I need to suppress the conversion by the ALV and do it myself once the currency key is known.
    How can I suppress the automatic input conversion which is done by ALV?
    There is no such problem in SAP GUI ALV! There is event DATA_CHANGE with similar change object:
    io_data_change->mt_good_cells
    io_data_change->mt_mod_cells
    io_data_change->mt_inserted_rows
    io_data_change->mt_deleted_rows
    But all the changes in table io_data_change->mt_mod_cells are in an external format (exactly the way user entered them on the screen)!
    Any idea?
    Thank you in advance for your help.
    Tomas
    Edited by: Tomas Havlik on Oct 5, 2010 10:24 AM

    I have contacted the Web Dynpro ALV support directly to find out the answer.
    There is no solution!
    The WD ALV always convert the key figure into internal format. It is not possible to get the raw user input in WD as it is in SAP GUI.
    Therefore, I use a workaround in my application - I remeber the number of decimal places of the old currency key and if the new currency key has different number of decimal places, then I shift the decimal point to the right or left correspondingly.

  • Formula node: type conversion

    Hello guys
    I have LV 5.0 and have to edit a script which has some kind of overflows. For testing I set all variables to the hightest usable range - extended or i32. Now I see, in all formula nodes, there are type conversions. How can I change the type of the inputs/outputs of the formula node?
    Hardware_Tester
    My first language is German, please ignore my faults...

    Hi,
    I forgot that you run Lv5.0. My example refers to Lv7.1.
    As far as I know in Lv7.1 the input variable type changes automatically as you connect a control.
    On the contrary the output is DBL by default but you can change it in the formula node introducing an explicit declaration of that variable (see "h" in the attached picture).
    Here are some useful link:
    http://forums.ni.com/ni/board/message?board.id=170&message.id=12253&requireLogin=False
    http://digital.ni.com/public.nsf/3efedde4322fef19862567740067f3cc/d6bed7d73659c43586256a7300691c26?
     Sorry, I understand that this cannot solve your problem but I don't remember how Lv5.0 works with formula node.
    Regards
    CLD - Labview Certified Developer
    Attachments:
    untitled3.gif ‏42 KB

  • Problem of automatic widening conversion

    Hello,
    base one link below:
    http://docstore.mik.ua/orelly/java-ent/jnut/ch02_04.htm
    Finally, the notation Y* means that the conversion is an automatic widening conversion, but that some of the least significant digits of the value may be lost by the conversion. This can happen when converting an int or long to a float or double. The floating-point types have a larger range than the integer types, so any int or long can be represented by a float or double. However, the floating-point types are approximations of numbers and cannot always hold as many significant digits as the integer types.
    int = 32 bits
    float = 32 bits
    why from int to float, will have problem? can show example or diagram of bits of problems?
    long = 64 bits
    double = 64 bits
    why from long to float, will have problem? can show example or diagram of bits of problems?
    Thanks.

    812322 wrote:
    ... the notation Y* means that the conversion is an automatic widening conversion, but that some of the least significant digits of the value may be lost by the conversion. This can happen when converting an int or long to a float or double. The floating-point types have a larger range than the integer types, so any int or long can be represented by a float or double. However, the floating-point types are approximations of numbers and cannot always hold as many significant digits as the integer types.
    int = 32 bits
    float = 32 bits
    why from int to float, will have problem? can show example or diagram of bits of problems?
    long = 64 bits
    double = 64 bits
    why from long to float, will have problem? can show example or diagram of bits of problems?Considering just positive double (ignoring 32-bit float).
    In a Java double (IEEE754 floating point)
    one bit is used for the sign,
    11 bits are used for the magnitude and
    52 bits are used for the mantissa (the digits)
    A Java double can store an int because an int only has 32 bits.
    A Java double can store a long that uses only 52 bits.
    When converting long values in the range [ 0x0010000000000000 ; 0x7FFFFFFFFFFFFFFF ]
    because 11 bits are used for the magnitude
    there are not enough bits in the mantissa to represent every long value.
    Exercise:
    Write a Java application that converts randomly selected long values
    in the range [ 0x0010000000000000L ; 0x7FFFFFFFFFFFFFFFL ] to double and
    then back to long - compute the divergence (if any) - print (in hexadecimal)
    the long value and the divergence.

  • Implicit and explicit Type conversion using Type object in heap

    Hi,
    I am surprised how Implicit and explicit Type conversion works using Type object in heap. for example when implicit type conversion occur what pointer it returns to object and similarly with explicit type conversion.

    Hello,
    >> I am surprised how Implicit and explicit Type conversion works using Type object in heap.
    For Implicit conversions: Typical examples are conversions from smaller to larger integral types, and conversions from derived classes to base classes. For the first one, the reference would be different which means it would return a different pointer to
    a new object. For the reference type, it actually points to the same memory location, you could use the object.ReferenceEquals() to check it.
    For Explicit conversions (casts):Typical examples include numeric conversion to a type that has less precision or a smaller range, and conversion of a base-class instance to a derived class. For first one, it would perform the same with implicit conversions.
    While for the conversion of conversion of a base-class instance to a derived class, actually, there's no built-in way to do this conversion.
    Regards.
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • Can I set a text field to automatically type in caps when I have converted a form to fillable in ADO

    When people get to the field where they have to enter their postal code, I want it to automatically type in capital letters whether they do that or not.

    Is there something like this that will allow me to type only the first letter of each word in a fillable field as a capital letter?
    For example:
    This Is What I Want It To Look Like

  • The priority of different data type conversion

    Hi All,
    I want to know the priority of data type conversion rule. if in an expression, I have several kind of data type( I, P, F,N..).
    Then finaly, all the data object will convert to which data type?
    I don't know the priority of data conversion.
    E.g.   data a type i. data b type p. data c type f.
             a = b + c.
    or    data d type p, data e type f.
          if ( d > f ).
    Then who will convert to who's type?
    Thanks and Regards.
    Aaron

    For expressions, the right term in SAP is "calculation type", it's explained here : [abap help - determining the calculation type|http://help.sap.com/abapdocu_70/en/ABENARITH_TYPE.htm]. SAP takes the "biggest" type of all variables in the expression. It can be I, P or F (smallest is I, biggest is F).
    Conditions are handled differently, just using data type conversion (see link given above by Abhishek), SAP converts from smallest to biggest type (in your case, it converts P to F and compares the two F variables).

  • Need Help with data type conversion

    Hello People,
    I am new to java, i need some help with data type conversion:
    I have variable(string) storing IP Address
    IPAddr="10.10.103.10"
    I have to call a library function which passes IP Address and does something and returns me a value.
    The problem I have is that external function call in this library excepts IP Address in form of a byte array.
    Here is the syntax for the function I am calling through my program
    int createDevice (byte[] ipAddress).
    now my problem is I don't know how to convert the string  IPAddr variable into a byte[] ipAddress to pass it through method.

    Class InetAddress has a method
    byte[]      getAddress() You can create an instance using the static method getByName() providing the IP address string as argument.

  • My ipad automatically jumps from one app to other. it automatically types things randomly. i dont know what it wrong. Have shown it in a service center. they have done factory reset but problem still persist.

    my ipad automatically jumps from one app to other. it automatically types things randomly. i dont know what it wrong. Have shown it in a service center. they have done factory reset but problem still persist.

    Likley a defective touchscreen.

  • Invalid data type conversions

    what are the invalid data type conversions in ABAP ???
    Moderator message: please search for available information/documentation.
    Edited by: Thomas Zloch on Mar 10, 2012 6:01 PM

    No Amanda,
    The values that I see in message monitor are also those that comes to XSLT programs as input.
    I investigated our problem a little further myself:
    1) XI always converts messages into XML format - this everybody knows.
    2) In XI documentation it is declared that XI uses ISO 8601 for DATE type formatting. That's why you see dates in format YYYY-MM-DD in XML data in message monitoring.
    3) The appearance of those decimal values are not that obvious for me. If XI uses ABAP transformation for message content then applies the rules for converting ABAP data types into XML. For this there is a SAP document 'ABAP - XML mapping' from TechEd2004. This document seems to describe how ABAP data types are handled by XML transformation.
    Anyway, we currently need to play with decimal values in XSLT mapping programs inside XI:
    a) add leading 0 integer if source value < 1
    RFC returns 0.123 -> XI converts to XML '.123' -> XSLT mapper should return '0.123' ->SOAP response returns '0.123'
    b) add decimal point and trailing zeros
    RFC returns 0.000 -> XI converts to XML '0' -> XSLT mapper should return '0.000' ->SOAP response return '0.000'
    With dates, the problem is actually on documenting mapping rules when writing interface specifications. If you would write an EAI-solution-independent conversion rule (RFC/date->SOAP/char) for date field it could sound like: YYYYMMDD -> dd.mm.yyyy. This works semantically between these systems but would not work for XI-developer, because he get YYYY-MM-DD from the RFC.
    Additionally the decimal type conversion requirements in XSLT mapping programs probably only applies XI and are therefore not reusable in other EAI environments.
    I would be glad if somebody would still have further comments for this data type conversion issue.
    br: Kimmo

  • WebDynpro call Returns an exception: Type conversion error

    Hi,
    I'm trying to start some of the standard SAP web dynpro .
    most of then work fine.
    some don't and i get the following error message.
    Root Cause
    The initial exception that caused the request to fail, was:
    +com.sap.aii.proxy.framework.core.DataAccessException: Type conversion error, field TAX_PER_DIEMTAX, complex type class com.sap.xss.tra.tre.model.expenses.Ptrv_Web_General_Data_Int+
    +at com.sap.aii.proxy.framework.core.JcoBaseTypeData.propagateJcoException(JcoBaseTypeData.java:130)+
    +at com.sap.aii.proxy.framework.core.JcoBaseTypeData.setElementValue(JcoBaseTypeData.java:751)+
    +at com.sap.tc.webdynpro.modelimpl.dynamicrfc.DynamicRFCModelClass.setAttributeValue(DynamicRFCModelClass.java:482)+
    +at com.sap.tc.webdynpro.progmodel.context.GenericModelClassCopyHelper.setAttributeValue(GenericModelClassCopyHelper.java:69)+
    +at com.sap.tc.webdynpro.progmodel.context.CopyService.copyCorresponding(CopyService.java:55)+
    +... 66 more+
    See full exception chain for details.
    could anyone give me an hint.
    jco connetion are made and testet for:
    sap_r3_humanresources
    sap_r3_finacials
    sap_r3_selfservicegenerics
    sap_r3_travel
    analog the *_MetaData
    Thank in advance
    Maximilian

    Hello
    did you solve this problem? I have the same error
    Regards

  • Data type conversion JCO To ABAP( Double to DEC)

    Hi,
      I want to update a field having data type as DEC with length 11 in APO system using JCO.Whatever i give as input is not getting reflected in APO system. Instead i get some different value.
    It seems that there is some data type conversion for that field..
    Thanks
    Archana

    if(tableName.equals("BAPI10001LOCPRDVERS2"))
                                                           table.appendRow();
                                                           //System.out.println("getting inside table "+tableName);
                                                           table.setValue("SOP112","PRODUCT");
                                                           table.setValue("SCMTEST111","LOCATION");
                                                           table.setValue("1001","LOCTYPE");
                                                           table.setValue("SCMTEST111","LOCATION_INT");
                                                           table.setValue("000","PLANNING_VERSION");
                                                           table.setValue("5000","SAFETY_DAYS_SUPPLY");//this is the field having problem
                                                           table.setValue("5","SAFETY_STOCK");
                                                           table.setValue(" ","SAFTY_STOCK_CALC_METHOD");
                                                           table.setValue("5.00","OPENING_PERIOD");
                                                           table.setValue("15","FORECAST_HORIZON");
                                                           table.setValue(("20000"),"VMI_PROM_LEAD_TIME");
                                                           table.setValue("0","MINIMUM_LOT_SIZE");
                                                           table.setValue(bd1,"TARGET_DAYS_SUPPLY");

Maybe you are looking for

  • Problem in capturing excse invoice

    Hi, I am facing a problem while capturing excise invoice. I made goods receipt with reference to a single PO containing 3 line items by 101 mvt type. after that i reversed that document using mvt 102 for line item 2 and 3. Now the Original GR documen

  • 7.1 SLD-LMBD. Advice needed: duplicated entries for SAP systems

    Hi Experts, I've noticed few duplicate entries that appear in SOLMAN 7.1 during the content synchronization from SLD to LMDB and migration from SMSY to LMDB. For instance: I already had CRM syetem in Solution Manager: CRD After the SLD-SMSY-LMDB sync

  • Hidden and hiding files and folders

    how do I hide or unhide hidden files or folders?? I have a directory that I want to hide so that other people can't see it or get access to it. (or at least limit the people who can see it and get access to it.) How do I set it up to protect that dir

  • Tab setting in JTextPane

    Hi, I am going to develop an simple XML editor which will provide following functionalituies. * Automatic Indentation * Highilight attributes of given schema * Tag Validation. I decided to use JTextPane. 1) Is It right choice for Rich Text Support ?

  • Not mutually convertible structure and itab

    Hi All, I have defined a structure struct with table ekpo and itab with include structure ekpo. Itab : DATA: BEGIN OF ITAB OCCURS 10.             INCLUDE STRUCTURE EKPO. END OF ITAB. and Struct DATA: BEGIN OF STRUCT.         INCLUDE STRUCTURE EKPO.