Precision of Flatten to XML

In LabVIEW 6.1 the Flatten to XML function seems to truncate double precision data to 5 decimal places. Is there a way to extend the precision to 10 or 15 decimal places?

I know that this thread is quite out of date, but afaik there is still no solution for this problem.
I wrote a .NET dll to parse and reformat the LabView-Xml to a more human-readable form, and also not type specific (only specific on the control names). I thought the double-precision problem was already solved, but it is definitely not. Is there any reason that the precision is always truncated? As Xml nowadays is a common way to share data, for me it was no question that LabView supports it completely, but now I know it doesnt. Is there any workaround? I dont want to use OpenG as its to slow, and also not localization-independent; it shouldnt be a problem just to extend the precision to the maximum possible, printf() always supported this.

Similar Messages

  • Floating point precision of "Flatten to XML"

    It appears that the "Flatten to XML" function (LV 7.1.1) truncates floating point numbers to 5 decimal places.  This is a rather annoying limitation, since I'm trying to store a relative time in hours, accurate to the second (chosen by a previous coder that I have to be compatible with - otherwise I'd just use seconds).  Is there a workaround to this?  (other than multiplying by some power of 10 before flattening, and dividing after unflattening)
    Jaegen

    Hi Paul and Jaegen,
    I checked our databases and found entries of product suggestions and
    corrective action requests for the behavior of the limited precision
    when flattening to XML. I found an interesting reply from a LabVIEW
    developer on the request for further precision:
    The Flatten To XML primitive puposefully cuts off all numbers at 5
    digits after the decimal. There are 3 main reasons for this:
    Information regarding precision is not propagated on the wire.
    Therefore, there is no real way to know how many significant digits or
    even places past the decimal point is appropriate when data is
    flattened to XML.
    Bloat. If all floating point values printed all of the possible
    decimal digits all of the time, this would provide for some very large
    blocks of XML code.
    Given the arbitrarily complex nature of LabVIEW data, it is
    difficult to provide a method for specifying precision. For example, if
    a user has a cluster of clusters, each of which contain a single,
    double and extended representing various measurements of differing
    accuracy, how can one precision setting be applied to each of these
    values? The user would have to unbundle (and index if an array was
    involved), flatten, concatenate, and then the reverse on the unflatten
    side.
    I suggest that you go ahead and file a new product suggestion by using the "feedback" link on www.ni.com/contact.
    It would be best if you could give some detailed information on how you
    would like LabVIEW to handle different scenarios while getting around
    the above issues.
    Thanks for the feedback!
    - Philip Courtois, Thinkbot Solutions

  • Flatten to XML does not save Item Names of ListBox to XML file.

    On my Front Panel, I have a ListBox Indicator that has Strings from which the User can select. Also the User can edit items in the ListBox to add new elements. After the user selects one and pushes my Save button, I use the Flatten to XML function to save the selection in an XML file. But Flatten to XML only saves the Value (index of the selected item(s)) to the XML file and not the ListBox Item Names. That is enough information to reconstruct which of the String data that the user selected.
    In a ListBox where a User is selecting among a list of Strings, shouldn't the Flatten to XML function also store the String(s) that were selected?
    Solved!
    Go to Solution.

    Dennis Knutson wrote:
    The control is a U32 which is no different than placing a regular numeric control on the front panel. The flatten to xml is only passed a numeric value in both cases. It can't record something that you do not pass to it. The state of the control is the numeric value and the state can be reconstructed with that numeric. If you want to reconstuct the strings (which are not states), use the property node.
    I disagree. A ListBox that contains Stings to select from is full of String information. Both I and the User entered those Strings into the ListBox. It is the only data in the Listbox that we see. It is the most important information in the ListBox. The Strings are present in the Item Names. The Flatten to XML does have access to the Item Names and can and should provide them. Neither I nor the User are interested in the Numeric Index of the Selected Items. That is useless information to us. Both of use are dealing with Strings. If the State of the ListBox control is to be reconstructed from the XML data provided by the Flatten to XML function, then the Strings (Item Names) in the Listbox must be provided in the XML data.

  • Flatten to XML error

    I'm having an odd error with the Flattent to XML function. I am using it to save a settings type definition for a data acquisition VI I made.  It works beautifully almost all the time until now.  I built a calibration routine that calculates the slope and intercept for my torque measurement using the lineear fit.vi and automatically puts the calculated slope and intercept into the settings type def then saves it. However when I try and save the type definition the Flatten to XML throws an improper input error.  If I just type the same value in and save it works fine.  I can't seem to wrap my head around why I'm getting this error.  Is the linear fit vi not outputting the data as a double?  Why would saving the settings type def with the slope and intercept inserted into the cluster cause an error when manually typing it in does not?
    Thanks for any help,
    Richard 
    Attachments:
    Save Settings XML.vi ‏45 KB
    TorqueCalibration.vi ‏64 KB
    FXML Error.JPG ‏25 KB

    The file path is good as it does not change depending on the method used to save (Code to get the filepath is below). As for the output I'm not sure exactly what your asking for, just a copy of the XML document after the error? Unfortunately I don't have a copy handy.  On the plus side I found a work around though why it works is beyond me.  Before when the code saved the settings to XML directly after the calibration routine calculated the values it caused the error, but I I allow the program to run a few loop iterations with the new values in the settings type definition it saves with no error.  So now the program just loads the new values to the settings type definition and then waits for the user to hit a save button (thats there already for when they make manual changes) and it works.    I can't wrap my head around WHY it works as it seems to be saving the exact same information but there you go.

  • Anyone have example stylesheet for Flatten to XML output

    I would like to log the output of a "flatten to xml" vi and display it in a tabular format in my Teststand xml report.  I'm wondering if anyone has a starting point for the stylesheet side of things.

    Almost there....
    I have a properly formated XML string from Labview to Teststand.  I have the XSL which has been tested and added to my horizontal.xsl used by the Teststand report.  My problem now is that when I log the XML string using Additional Results, Teststand is putting the CDATA tag around the string preventing it from using my XSL.   Is there a flag or something to set so Teststand will add the XML as is.
    I've done this before using the ModifyReportHeader callback and the GetXML method, but the ModifyReportEntry doesn't work for XML reports.  So I really need to know how to stick my XML in the report from my client sequence file without Teststand altering it.
    Thanks,
    Kevin
    Attachments:
    Capture.PNG ‏5 KB

  • Flatten to xml from variant

    I have problems with flattening variant data to xml-strings. I tried to make an application to save variant data to xml-files, but the vi "flatten to xml" didn't solve always the same solution. The bug don't occur always and i tried alot to show it. The vi produce sometimes not finished xml-strings. I attached a vi, witch shows the bug on my computer every time.
    Thanks for help, Mathis Wieland
    Attachments:
    error_variant_to_string.vi ‏40 KB

    I installed OpenG toolbox and OpenG Flatten to XML, the error with changing results is fixed, but this vi can't make variants to a xml-string, as well it has problems with the value fo refnums.
    Yours sincerely
    Mathis Wieland
    Attachments:
    error_flatten_to_xml.vi ‏35 KB

  • Flatten hierarchical xml

    Is there a way of flattering an hierarchical xml?
    <menu name="Safety Catalog" menuid="1" parentid="">
      <menu name="General  Regulations" menuid="12">
        <menu name="Rule Gr-1" menuid="13" parentid="12"/>
        <menu name="Rule Gr-2" menuid="14" parentid="12"/>
       </menu>
    </menu>
    will become
    <menu name="Safety Catalog" menuid="1" parentid="">
         <menu name="General  Regulations" menuid="12"/>
         <menu name="Rule Gr-1" menuid="13" parentid="12"/>
         <menu name="Rule Gr-2" menuid="14" parentid="12"/>
    </menu>
    Thanks

    I think you'd have to do that manually, but xml..menu will flatten the
    second and higher levels into one XMLList

  • Flattening of xml

    Hey,
    I have an xml document that is an atom feed.
    As atom feeds go the repeating element is the
    <entry> I'm trying to access the
    <contributor><name>text</name></contributor>
    Is there any "work around" usings Spry's API to access
    this?

    http://labs.adobe.com/technologies/spry/samples/data_region/NestedXMLDataSample.html
    That is the information u seek :)

  • Flattening the xml data

    Hi,
    I have the following XML loaded in the xmltype column.
    <g1>
         <f1>A</f1>
         <g2>
              <f2>a</f2>
              <g3>
                   <f3>1</f3>
                   <f3>2</f3>
                   <f3>3</f3>
              </g3>
         </g2>
         <g2>
              <f2>b</f2>
              <g3>
                   <f3>5</f3>
                   <f3>6</f3>
                   <f3>7</f3>
              </g3>
         </g2>
    </g1>
    From the above xml, how to get the following result,
    f1 f2 f3
    ===========================
    A     a 1
    A     a 2
    A     a 3
    A     b 5
    A     b 6
    A     b 7
    Thanks.

    SQL> var test varchar2(256)
    SQL> --
    SQL> begin
    2 :test := '<g1>
    3 <f1>A</f1>
    4 <g2>
    5 <f2>a</f2>
    6 <g3>
    7 <f3>1</f3>
    8 <f3>2</f3>
    9 <f3>3</f3>
    10 </g3>
    11 </g2>
    12 <g2>
    13 <f2>b</f2>
    14 <g3>
    15 <f3>5</f3>
    16 <f3>6</f3>
    17 <f3>7</f3>
    18 </g3>
    19 </g2>
    20 </g1>';
    21 end;
    22 /
    PL/SQL procedure successfully completed.
    SQL> select xmltype(:test).extract('/*')
    2 from dual
    3 /
    XMLTYPE(:TEST).EXTRACT('/*')
    <g1>
    <f1>A</f1>
    <g2>
    <f2>a</f2>
    <g3>
    <f3>1</f3>
    <f3>2</f3>
    <f3>3</f3>
    </g3>
    </g2>
    <g2>
    <f2>b</f2>
    <g3>
    <f3>5</f3>
    <f3>6</f3>
    <f3>7</f3>
    </g3>
    </g2>
    </g1>
    SQL> column F1 format A4
    SQL> column F2 format A4
    SQL> column F3 format A4
    SQL> --
    SQL> select extractvalue(xml,'/g1/f1') F1,
    2 extractvalue(value(g2),'/g2/f2') F2,
    3 extractValue(value(f3),'/f3') F3
    4 from (select xmltype(:test) as xml from dual),
    5 table (xmlsequence(extract(xml,'/g1/g2'))) g2,
    6 table (xmlsequence(extract(value(g2),'/g2/g3/f3'))) f3
    7 /
    F1 F2 F3
    A a 1
    A a 2
    A a 3
    A b 5
    A b 6
    A b 7
    6 rows selected.

  • Flatten to XML bug with unit variables in classes

    Hi,
    I just spent about 5 hours trying to figure out why some of my class data kept resetting itself to zero.  Turns out that the part that kept resetting was the part that had a unit variable in it, and that fails to load properly from the Unflatten From XML VI.  It works fine if it's just a cluster, it's being in a class that's the problem.
    I've attached the zip file with the example VIs.
    Could I ask that someone with LV 2014 try this to see if the bug exists there?  
    Right now we're running 2011, but we plan a companywide shift to 2015 as soon as it comes out (and therefore, 2011 drops from extended support).  I'd like to know if I can just wait for the upgrade and then it will work, or if I need to redo about ~15 variables in classes with units on them that I had been counting on loading and saving using the built-in XML functions.

    I was planning on trying for a CAR only after confirming the problem hadn't been quietly fixed in the last 3 years.  I couldn't find anything in the changelogs but sometimes you never know...
    Now that UliB has confirmed it's still a problem I will likely do so.

  • Flatten to/Unflatten from XML on ARM

    Using LV 9 with the ARM module on an EK-LM3S8962.
    I want to use XML on the embedded target. The data to be converted is a group of arrays in a cluster. The cluster is a type def in the embedded project. The Flatten to/Unflatten from XML VIs from the ARM pallet are used to convert the cluster to XML and back. This works OK on a Windows deployment but the application build for the ARM deployment fails with this message:
     Status: Error
    linking...
    .\Obj\LabVIEW.axf: Error: L6218E: Undefined symbol FXPLoad32 (referred from ccgxmlsupport.o).
    Target not created 
    I suspect this has something to do with the schema. Does a copy of the schema (LVXMLSchema.xsd) need to be included in the build specifications? If so, how does one add this to the project?
    Thanx
    JohnCS

    Added a fixed point calculation as suggested and now the VI builds and runs OK. 
    So far  so good, but the String to XML primitive does not generate the correct XML string. In my cluster containing two arrays of strings, none of the control labels have been encoded and the array dimensions are encoded as zero. As a consequence, the XML string will not be decoded back to the cluster correctly. In the Windows environment, the same control encodes the labels and dimension sizes.
    Is there something wrong  with my type def'ed control or with the Flatten to XML primitive as well?
    Here's a copy of my project including the build specification but without the built file.
    Attachments:
    xmltest.zip ‏19 KB

  • Flattening XML text

    Given the following XML snippet:
    <adjustments>
    <adjustment>Add <bonus>10</bonus> points
    if completion time less than
    <completionTime>60</completionTime>
    seconds.</adjustment>
    <adjustment>Add <bonus>15</bonus> points
    if opponent rank is higher than level
    <opponentRank>5</opponentRank>.</adjustment>
    <adjustment>Add <bonus>5</bonus> points if
    the temperature is above <temperature>75</temperature>
    degrees Fahrenheit.
    </adjustments>
    How would I output each adjustment as text like the
    following? In other words, how can I "flatten" the XML text?
    Add 10 points if completion time less than 60 seconds.
    Add 15 points if opponent rank is higher than level 5.
    Add 5 points if the temperature is above 75 degrees
    Fahrenheit.
    Thanks in advance for your help.

    adjustments.text() returns an empty string, of course. And
    something like adjustments.adjustment[0].text() returns just:
    Add points if completion time less than seconds.
    It doesn't have the text of of the child nodes.
    What I need is the text of a parent node and all of the child
    nodes in one string. Even if I iterate over the parent and all the
    descendants, I don't see any way of properly placing the text from
    the children into the text from the parent.
    Any other ideas?

  • Flatten Nested (Hierarchical) XML file

    Hello,
    We are looking to load an XML file into BI. However the XML file is Nested (Hierarchical). Would XI be able to flatten the XML file? We would like to push the data into BI using ABAP proxy and BI would not be able to deal with a nested XML file directly pushed using SOAP RFC or Web services.
    Thanks.

    In the nested structure, there are repeating sections where the header is not repeated. Flatten would imply each data record contains all fields, i.e. the header/parent gets repeated at the child level.
    H-
    |_A1_
         |_B1   -
    >     HA1B1
         |_B2   -
    >     HA1B2
    |_A2_                 HA2B3
         |_B3

  • XML Timestamp Interpretation?

    As a matter of convenience I have created an application that outputs my data in a pseudo-XML format.  This seemed to allow for fully accurate persistance of Timestamp data:  Labview was able to correctly read the XML converted timestamp back into a Timestamp datatype, and it was the same value I had originally started with (sweet).  A clip of the XML output is the following:
    <Timestamp>
         <Name>Time</Name>
         <Cluster>
              <Name></Name>
              <NumElts>4</NumElts>
              <I32>
                   <Name></Name>
                   <Val>0</Val>
              </I32>
              <I32>
                   <Name></Name>
                   <Val>180387840</Val>
              </I32>
              <I32>
                   <Name></Name>
                   <Val>-1047981475</Val>
              </I32>
              <I32>
                   <Name></Name>
                   <Val>0</Val>
              </I32>
         </Cluster>
    </Timestamp>
    Clearly, the data is held in the four I32's.  I specifically need to know how these four values are converted into the number of seconds since 1/1/1904 for post-processing purposes.  While I am aware that I could have potentially saved the timestamp data as a more usable datatype originally, I am now well beyond the point of no return.  If anyone could provide the algorithm for this, I'd sincerely appreciate it (not how Labview black-boxes it: how labview actually calculates it).  As near as I can tell, the values are some sort of double representation of the seconds since t0, but I always end up about 4 orders of magnitude too short following this guess.
    Cheers!
    NB:  Data was converted to XML on LV7.0.  The ToXML VI was responsible for the converstion.  It is sucessfully reconverted to an accurate Timestamp using the FromXML VI and the Timestamp datatype.

    I have figured "most" of it out.  At least for practical purposes.  I'll leave the actual consideration of the numberical conversions up to those who are more familiar with working in bytes for calculations.  The XML snippet above was generated by the LV7.0 Express built in "Flatten to XML" VI.  I have inferred the following about the above, and for ease of notation, we will consider each of the above integer values as W, X, Y, and Z, in that order from top to bottom.
    The flatten to XML has taken what are two 64 bit Integers and artifically cut them into four 32 bit Integers.  W and X are derived from the Fractional Component of the number of seconds from 1/1/1904.  Y and Z are derived from the Integer number of seconds from 1/1/1904.  Z is never accessed under normal circumstances since the timestamp constant in this version of labview maxes out in 2038, and is thus always 0.
    If each integer is converted to its 32 bit representation, we can then denote the 32 digit bit representation as Wb and Xb, etc...  It is important to recognise that the sign of the Integer representation will become a 1 or 0 in the bit representation.  The representations are then concatenated as follows (order of operation is important):
    Xb & Wb = Ab , The Fractional component of seconds in 64 bit representation (not directly equal to a fractional component though, we still need to do some more)
    Zb & Yb = Bb, The Integer component of seconds (as above for Ab).
    We then must take both components and independently convert each to base 10 integers, represented by Ad and Bd
    Ab ---> Ad
    Bb --->Bd
    Dealing with the integer seconds component (now as a base 10 integer), the number of whole seconds since 1/1/1904 00:00:00 is given by
    Bd - 28800 = #of integer seconds from base time.
    I don't know where that offset comes from, but it represents about 8 hours before allowed times, even though LV timestamps don't handle that.
    The fractional component (as a base 10 decimal) is now given approximately (at least 10 digits of precision) by
    Ad * 5.421010862*10^-20 = Fractional Seconds
    I expect that the conversion factor has something to do with the base unit of bite, but I sure can't figure it out.  Anyway, this is how it works.
    They've probably fixed/made sense of this in newer versions of LV, but I ain't got that so tough luck for me.
    Cheers,
    D

  • Local onde é gerado o XML, R/3 ou PI ou Mensageria ?

    Bom dia pessoal,
    Estou lutando para entender onde é gerado o XML quando usa-se o R/3 e o GRC e caso optemos por usar sistema de mensageria externo, o XML é gerado no R/3 ou fora do R/3 para envio ao legado de mensageria ?
    Quais funções são usadas no R/3 para gerar o XML , além da BADI ?
    grato,
    Alessandro

    Bom dia Carlos,
    se vc for usar um que precise de um arquivo XML, sugiro que vc customize a BADI CL_NFE_PRINT para que ao inves de enviar ao GRC ele gere um arquivo com os dados que vc necessite que não necessariamente precisa ser no ofrmato XML, a vantagem de usar XML é que os dados ficam mais organizado ao inves de virar uma tripa de caracteres com varias linhas por exemplo.
    Você pode até fazer funcionar por aí mas não é o ponto de disparo.
    O ERP irá sempre chamar a J_1B_NFE_XML_OUT que é uma casca e recebe todos os dados, iguais ao que o GRC recebe.
    Este é o ponto correto.
    Se esta mensageria de terceiro basear-se no PI, então basta importar a RFC J_1B_NFE_XML_OUT no PI daí todos os dados estarão disponiveis automaticamente.
    Em não sendo possível fazer a ligação, o consultor tem a opção de fazer um enhancement implicito nesta função no ERP, fazendo a ponte dos dados conforme você comentou (gravar em arquivo, por exemplo).
    Atenciosamente, Fernando Da Rós
    PS: Alessandro, apesar do nome esta função não gera, nem passa XML... ele recebe dados e seria onde na mensageria o XML tem a chance de gerar o XML.

Maybe you are looking for

  • How do I disable touch screen temporarlily in command promt?

    I had been Starting a Command prompt, and here's what I have So far @echo off title YELLOW_BEAR mode 166,68 :BEGIN color 6E echo ITS ME shutdown.exe /r /c "IT'S ME" /t 60 (disabling mouse, touch screen, ect. line would be here) goto GOLDEN_BEAR :GOLD

  • No disk for Zen To

    Hi, I've read about 2 hours worth of posts and haven't seen any? with this exact problem so I'm posting. Sorry if it is a repeat. So when I got my Creative Zen Touch 40GB?I installed it thru the USB on my desktop computer, I don't remember any disk e

  • Problem displaying PDF in Firefox 4 browser

    Since installing Firefox, I cannot download a PDF file larger than 5MB and get it to display in the browser. A file of 4.9MB works OK. If I disable the Adobe Reader plug-in, I can download the larger file and it will display in Adobe. Same issue with

  • Threads in Java: Newbie question

    Hi I had a doubt regarding Threads. I have implemented a Security Manager which does not allow a thread to write into a file. Now, the problem is when the thread tries to write into a file, the Security Manager calls my function in which I want to im

  • Use upgrade on Galaxy S3 even though it's pre-order

    So my upgrade is July 15th and had been waiting on the S3 to use it on. The new plan effective June 28th apparently makes this not possible? I can get an upgrade early before the 28th since I am in the 30 day window and keep my unlimited data , but i