Problem number (scientific notation) string vs

Hi all

This has been driving me crazy now for what feels like eternity. To illustrate my problem, I have associated my code as much as possible for only the parts needed. Please, if anyone can help, I would be very grateful. (I will not be able to graduate without completing this nightmare project, and it's the only part that I'm stuck. "It is essential to the function of the program.)

Thank you!

The program (this part of it anyway):

The program should import the contents of an xml file and place them in a datagrid control. The DataGrid contains two columns: membership and evaluated.

The problem:

Evaluates seems to be automatically converted into a number... and the WRONG number to that! It is CRUTIAL that this value is imported as a string or the correct number. In addition, it is only evil sometimes. (See 1G2I vs NP_126160).

Table of problem: Evaluated in Flex must be the same as rated in XML

Membership Rated in Flex Rated in XML
NP_5794483.999999999999999e - 92

4th-92

NP_1435483.999999999999988e - 84

4th-84

1G2I1.999999999999997e - 81

2nd-81

NP_1261601E-80

1E-80

YP_0029594358th-80

8th-80

ZP_048895922.999999999999994e - 79

3rd-79

ZP_048777842.999999999999998e - 77

3rd-77

YP_1836974.999999999999999e - 76

5th-76

YP_00023076702.999999999999994e - 75

3rd-75

Main.MXML

<? XML version = "1.0" encoding = "utf-8"? >

< s:Application ' xmlns:fx = ' http://ns.Adobe.com/MXML/2009 "

" = xmlns:s 'library://ns.adobe.com/flex/spark"" "

" = xmlns:mx 'library://ns.adobe.com/flex/mx"" "

"xmlns:views ="views.*"

width ="1400" height ="900"

preinitialize = "hitsResponder.token = service.send ()"> "

< fx:Declarations >

" .. s:HTTPService id ="service"" "

" url = 'data / TestCase.xml"" "

showBusyCursor ="true" / > "

" .. s:CallResponder id ="hitsResponder"" "

result = "service_resultHandler (event)" "

fault = "service_faultHandler (event)"/ > "

< / fx:Declarations >

< fx:Script >

<! [CDATA [ ]]

/ * Import * /.

import mx.utils.ArrayUtil;

import mx.collections.ArrayCollection;

import mx.rpc.events.FaultEvent;

import mx.rpc.events.ResultEvent;

import mx.controls.Alert;

/ * Variables * /.

[Bindable]

protected var scores: ArrayCollection collection;

/ * Managers * /

protected function service_faultHandler(event:FaultEvent):void

{

Alert.show (event.fault.faultString, event.fault.faultCode);

}

protected function service_resultHandler(event:ResultEvent):void

{

scores = event.result.hits.hit; visits //push in the collection of table

}

]]>

< / fx:Script >

"" < s:Panel id = "dataPanel" title ="results" width = "400" height ="470">

< s:layout >

"" < s:VerticalLayout paddingBottom = "10" paddingLeft ="10" paddingRight = "10" paddingTop ="10" / >

< / s:layout >

<! - results grid - >

{" < views: TestGrid dataProvider =" {}scores}"/ > "

<!---->

< / s:Panel >

< / s:Application >

views:TestGrid.mxml

<? XML version = "1.0" encoding = "utf-8"? >

< mx:DataGrid

xmlns:fx = » http://ns.Adobe.com/MXML/2009"" "

" = xmlns:s 'library://ns.adobe.com/flex/spark"" "

" = xmlns:mx 'library://ns.adobe.com/flex/mx"" "

width ="100%" height ="100%">

< mx:columns >

"" < mx:DataGridColumn dataField = "membership" headerText ="membership" sortable = "true"/ > "

"" < mx:DataGridColumn dataField = "rated" headerText ="rated" sortable = "true" "visible ="true"/ >

< / mx:columns >

< / mx:DataGrid >

TestCase.xml

< hits >

< hit >

< membership > NP_579448 < / membership >

4th-92 of < estimated > < / rated >

< / hit >

< hit >

< membership > NP_143548 < / membership >

< estimated > 4th-84 < / rated >

< / hit >

< hit >

1G2I < membership > < / membership >

2nd-81 of < estimated > < / rated >

< / hit >

< hit >

< membership > NP_126160 < / membership >

1-80 of < estimated > < / rated >

< / hit >

< hit >

< membership > YP_002959435 < / membership >

8th-80 of < estimated > < / rated >

< / hit >

< hit >

< membership > ZP_04880592 < / membership >

< estimated > 3rd-79 < / rated >

< / hit >

< hit >

< membership > ZP_04877784 < / membership >

< estimated > 3rd-77 < / rated >

< / hit >

< hit >

< membership > YP_183697 < / membership >

5th-76 of < estimated > < / rated >

< / hit >

< hit >

< membership > YP_002307670 < / membership >

3rd-75 of < estimated > < / rated >

< / hit >

< / hits >

This looks like a bug in the conversion of a string to a number. It may be a known bug, but you can drop if you want.

In the meantime, I can suggest a work around. In your HTTPService, set the resultFormat 'XML '. This will prevent the automatic analysis of the string to a number. View your Datagrid with string values. Then while sorting, use a custom comparison function.

Tags: Flex

Similar Questions

  • How to convert double to String without scientific notation.

    Hello

    I'm tring to convert a double 24,000,000.00 in string. But I got a string "2.4E7".

    Someone knows how can I avoid this problem of scientific notation?

    Thank you

    Have you tried to cast to an int?  something like:

    double d = 24000000.0;

    int i = (int) d;

    String s = "" + i; "

    Then just add the rest of your chain to get precision you would like...

    double rest = d & i;

    rest = rest * 100;

    s += "." + (int) remains;

    You would lose little accuracy due to rounding problems, but you can use the functions of rounding in the api to get a closer answer.

  • How let labview to check the string is in Scientific Notation.

    Hey all,.

    I want to labview to convert a worksheet string in a table. It's easy using the tool 'chain of worksheet to the table '. The only problem I have is that I get the string from a RS232 device and the critical moment arrives.

    Example:

    If I read the data from the buffer it gives me:

    1.50337800E + 00 + 1.70316300E + 00 for both channels, it is converted and accepted

    If there is a slight delay, I get:

    + 1.50337800E + 00 + 1.70316

    It is also accepted because + 1.70316 is also recognized as a number.

    How can program labview to check each number he reads is according to Scientific Notation?

    Thank you

    This regex seems to work for me, for all cases, I've tried:

    [+/-]\d+\.\d+[Ee][+/-]\d+

    Note that it is very restrictive and only follows the shape of ±n.nnnE±mm

  • Why the number is displayed in scientific notation

    I tried to add two numbers and got a result displayed in scientific notation.

    Then I used the ' DecimalFormat() ' function and the result is false.

    How can display the correct result. Help, please

    Please see the code I used

    < cfset N1= 1 >

    < cfset N2= 9999999999999899999999 >

    < cfset RESULT = N1 + N2 >

    < cfoutput >

    #RESULT #.

    <br />

    #decimalformat (RESULT).

    < / cfoutput >

    result:

    1E + 022
    92,233,720,368,547,760.00

    Thanks in advance



    #result #.

  • Remove the scientific notation in report

    I am calculating a number and put it in a box of comments on a report. It works very well, but one of the numbers has decided to display in scientific notation (1.52666667e - 3). The problem is that the comment box is not large enough to display scientific notation and gives no indication of more fit in the box. Instead, I see 1.52666 indication of the exhibitor. I had many prefer voir.001527 but I don't want to force a format of STR with "d.dddddd" because most of the numbers do not need this level of precision and I'd probably run into errors of numbers for example 12345 which does not fit in the 6 digit precision with forced comment box. If I can force it to scientific precision, it will probably be fine.

    BTW: is there a certain number range where scientific notation is the default value? If I had known this range I could then force the format with the STR function to display as I want. for example IF x >-001 and x<.001 then="">

    Or the other method would probably work for me.

    Thank you

    James

    Okay - I see also tiara auto repeat to scientific notation decimal formatting. I guess what you could do is to check the number of decimal places, the value has and if it exceeds a certain number, format him with d.ddd.

    Yes, something along the lines of: @@IIF (Len (valueToCheck)<10, valuetocheck,="" str(valuetocheck,="">

  • Coil a CSV without scientific notation?

    It gives me a headache! I can't wrap csv files, where the length of the number field is greater than 11 digits. For example 1.23832E + 11 should be 123831961495

    Is there something that can be changed in the below, which will prevent the scientific notation?

    COLUMN dcol new_value mydate noprint

    ALTER session set nls_date_format = "dd/mm/yyyy hh24:mi:ss";

    column normalised_event_id format '99999999999999999';

    column charge_id format '99999999999999999';

    SELECT to_char (sysdate + 1, 'YYYYMMDD') double dcol;

    coil \\three\departments\rabillsourcecode\RA_Dropzone\Data_Cap_Usage_ & mydate... CSV;

    set linesize 10000;

    set pagesize 0;

    colsep, value;

    Set trimout

    Set trimspool

    fixed term

    Set numw 14;

    NEWPAGE THE VALUE NONE;

    Thanks for any help you can provide!

    3012073 wrote:

    I'm just open in Excel itself, the problem is that when you import the csv file into Access, it pulls in the format of scientific notation and not the full value

    This is the point people are trying to do.  That's why Roger said to open the csv file in a TEXT Editor.  Excel is not a text editor.  Access is not a text editor.

    Your csv file is nothing more than a plain text file.  Open in Notepad and you will see exactly what was written about everything that created the file.  Any difference between that and what you see in Excel or Access, or anything else is the result of the way in which these programs attempt to interpret the file and is beyond the control of Oracle.  MS products are (in) famous for trying to be smarter than the user and the interpretation of entry of how Bill thinks it should be rather than what you want.

  • How to write the trillion or a quadrillion in scientific notation

    Hi all

    So basically my question is how can I write 5 Billiards (or whatever the numbers as millions or billions or trillions) in scientific notation on my iPhone or the keyboard. Just like below.


    5 x 1015


    I want to type without using the copy paste.

    Thank you for your time.

    Don't know way in a basic text page. You can do this in the application of the numbers, but this isn't what you're asking. The closest I can get is 5x10E15.

  • Fract/Exp Numbe display Format string

    I have a digital channel that has a decimal value with accuracy up to 16-digit figures. I want to convert this string to a numeric value, and I used a "Fract/Exp number necklace. In my VI I hae set:

    Data type: EXT (because it allows number of decimal digits of 15 to 20)
    Data format: covered Point
    Numbers: 16
    Precision Type: Digits of precision

    Here's my question: If the input string is composed of digits of precision = 15 Eg: 5.369607712106161
    Then I output = 5.3696077121061609, which is the same, but not the same number I sent.
    or 1.145152879691825 String gives me the number = 1.1451528796918251
    String 5.818356760119754 gives me the number = 5.8183567601197543

    Please suggest how I can make more specific output.

    Thank you.

    Kind regards

    H.

    Wire a constant to the default value with the entry of your string to the function of numbers and define the type of POSITION, it is default DBL (note the red dot on your meter).

  • all VI to convert a number to a string?

    Hello

    Have we not all VI to convert a number to a string?

    See you soon,.

    Forrest

    Hello.. Have you tried ' string/number conversion'...? You can find that to do a right-click on the block diagram-string/number of all the function - string - conversion...

    Just a thought... It could be that useful...

  • Retrieves a number to a string

    Hi all

    I want to extract a number from a string.

    Please tell me how to get there.

    the values are

    A1

    A2

    A3

    A4

    A5

    A6

    A7

    A8

    A9

    A10

    A11

    I want to retrieve only the figure.

    Thanks in advance.

    Like this perhaps?

    SQL > select to_number (regexp_substr ('a10','[[: digit:]] + "")) twice;

    TO_NUMBER (REGEXP_SUBSTR ('A10','[[: DIGIT:]] + ""))
    ----------------------------------------------
    10

    If this isn't what you want, please explain with some more detail as it is explained in the FAQ: Re: 2. How can I ask a question on the forums?

  • Check if there is a number to a string

    Hey guys,.

    If I had a '2 cats' string, how could use a tape Loop statement to check if there is a number in there

    I got this far:

    for (var i: Number = 0; i < string.length; i ++) {}

    If (Equation.charCodeAt (i) < = 57)

    {if (equation.charCodeAt (i) > = 48)}

    {trace ("Number")

    }

    }

    }

    It works, but is there a more effective to achieve AA?

    Any thoughts would be appreciated

    Thank you very much

    Chris

    You can also use exec() regexp method if you need to detect multiple instances. For example, this code:

    var string:String = "It is 12 o'clock 24 hours 365 days";
    var pattern:RegExp = /\d+/g;
    while (pattern.exec(string))
    {
        trace("exec", pattern.lastIndex);
    }
    

    Shows:

    Exec 8

    exec 19

    exec 29

    This means that the numbers are in positions 8, 19 and 29

  • fract/exp to problem number string.

    Hi ppl,

    I have a very simple question. I want to convert string 5.3696075E - 4 for the number. in my program, it gives me only 5.

    Please, help me.

    Your operating system is probably to use a comma instead of a period as the decimal separator.

    The Fract/Exp string to number function has an entry at the top Optional Boolean. The default value is True, revealing LabVIEW use parameter system OS for the separator.

    'Use decimal system (T)' set to false, and that should allow you to convert the string correctly...

  • Number in hexadecimal string conversion problem

    Hello

    for a serial communication, I need to send byte-code in an ascii hexadecimal string. When I use the constants and send them by VISA to the COM port it works fine, but if I use converters numbers it doesn't. Can someone show me what I'm doing wrong?

    deepearth

    --------------------------------

    Windows XP SP3, LV 8.5.1

    Since your string indicator is set to hexadecimal display, it seems you want to a hexadecimal string, a single byte/number.

    (You are currently using a hexadecimally format string, composed exclusively of ASCII of the 2 characters/byte "0.F" characters.) This is not what you want!).

    Here is another solution using type conversion:

  • Maximum value such as a number or a string

    Hallo,

    I calculated the maximum value of a channel. The next step is to use this value for further computation. My problem is that I can't use this value as a number. It is just a string. I tried with

    ChnPropGet then I got the number. But I can't use it for calculations. Anyone have an idea how I can fix this problem?

    I've attached a screenshot of my script. I use the German version of 12 DIAdem.

    Thanks for the help...

    Hello LePot,

    the properties. The function returns the property in its native type. If you navigate to the maximum property of a channel, it will return the value as a floating point number. You can check this by running the following script:

    (The script assumes that the dataset example is which has a number of Group 3 with a channel named "Res_Schall_1". But your chains should give you the same result with the message box showing "double."

    Dim Maximum
    Maximum = Data.Root.ChannelGroups (3). Channels ("Res_Schall_1"). Properties ('minimum'). Value
    MsgBox (TypeName (Maximum))

    If you ever want to convert a number represented as a string, be careful when you use "CDbl". This VBScript function assumes that the number is formatted by using the language of oyur BONES, especially the decimal setting (in '. 'or', '). If the setting of the operating system does not match the way the number is converted to a string, you have a problem. That's why the offer DIAdem::Str() to go a certain number to string s and Val() to go the opposite direction. Using CDbl can create rellay average errors that are difficult to detect.

    Andreas

  • Number of the string syntax - padding zeros in keeping the decimal values

    Hello team,

    I'm trying to get a number, paved with up to 3 zeros to the left and keep the two decimal places of it.

    IE: If the number is 6.25 then I want the string "006.25".

    If it's 60.125 I want to make "060.12" (rounded to the hundredth decimal closest)

    I tried using the 'String Format"with variations of differnet from the '% 03d' and '.2f '. but I can't have one the right combination of both of them in a single order. Am I missing something here?

    With the help of LV2011

    Thank you

    Have you tried %06.2f?

Maybe you are looking for

  • My Macbook air 2013 keyboard backlight exploded

    my light 2013 macbook air keyboard has just exploded, even when using the keys, that nothing past even when the bars aren't completely. to change the backlight Panel does not work or is a matter of logic board? These are its specifications

  • window.showModalDialog throws NS_ERROR_NOT_AVAILABLE: and onload does not work

    I created cutomized mozilla plugin for my purpose test. in the plugin, I use Window.ShowModalDialog to open a ".xul", and on the opening, I use the onload event, which calls the javascript function to fill some of the value for the file ".xul". It wa

  • Cannot open presentations stored in iCloud

    I can't open some of my critical Keynote presentations. I use iCloud on my mac and iPad. The error message for the two said: cannot open 'Title' for some reason any. To open this file, please restore it to a previous version. None of the previous ver

  • Qosmio X 500 - show very dull and can not seem to adjust

    Hello I have a problem with my screen is very dull. I can't settle. I tried (Fn F7) and is not move seems like its frozen but it appears on the screen.I tried to look under the display settings in the Control Panel, it says that it uses Nvidia as the

  • Want 5530: HP ENVY 5530 does not print

    Recently bought a HP Envy 5530 and together until my laptop via WiFi with the software downloaded from the URL the drive gave me (my laptop would not recognize the disc). Yesterday, I was able to print a photo from my phone (HTC a M8), without any pr