LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Using MS Office Report with an Excel Template

Solved!
Go to solution

Hi friends! I have a problem. I'm using MS Office Report vi to generate a report of an application with more than a hundred values of voltage measurements. But when labview transfers this values to excel template, the numbers with comas are transformed in a thousand... for instance, the number 1,009877 becomes 1.009.877. In other side the number 0,037455 apears correctly in excel. Can you help me? What can I do to solve this problem? Thanks!

0 Kudos
Message 1 of 8
(500 Views)

What is the format of the data you are trying to save as an Excel (.xlsx) document?  I'm assuming the data you are sending to Excel is a text file, possibly with numeric data (with either a period or a comma used as a decimal point), with a comma or a horizontal tab separating entries (and becoming "columns" in Excel, and with an EOL at the end of a line (which delimits a "row" in Excel).  

 

This format is a related to what has been called "Comma-Separated Variable", or .csv, which Excel "brands" by having Windows use an Icon that resembles the icon for a true Excel files (.xlsx).  If your PC is set up to treat a comma as a decimal point, LabVIEW will "sometimes" follow along (but this seems a little inconsistent).

 

A safer way to handle this is to use the format that LabVIEW called "Delimited Spreadsheet", where a horizontal Tab separates columns.  Now the comma's meaning (if present) is unambiguous -- it is a decimal point.

 

Can you create a small data file that you are trying to use, and attach it (as a text file) so we can examine it and get a better idea if my "guess" makes sense?  [If it doesn't, I'll try to "guess, again" ...].

 

Bob Schor

0 Kudos
Message 2 of 8
(478 Views)

I am sending numbers in DBL format. I think it should read correctly in Excel. I've already checked the Excel settings and there's nothing that justifies what's happening. I still haven't found a solution. Would you help me?

0 Kudos
Message 3 of 8
(433 Views)
Solution
Accepted by topic author MarceloPinto71

I think you're having an issue with your system decimal point.

 

All of the Excel RGT VI's I see accept text inputs, not double numerical inputs. Are you converting your double values to text before you put them in the report?

 

If so, it sounds like you have a problem with "," vs "." being thousands separator vs. the decimal point. Look in your Tools -> Options menu under "General", is the "Use localized decimal point" option checked?

 

Tell us if that's checked or not, and also tell us how you're formatting your data from doubles into text. Better yet, upload your code so we can take a look at it.

0 Kudos
Message 4 of 8
(422 Views)

@BertMcMahan wrote:

All of the Excel RGT VI's I see accept text inputs, not double numerical inputs. Are you converting your double values to text before you put them in the report?


The Excel Easy Table function is polymorphic, accepting 2D arrays of Text or Dbl.

 

Bob Schor

0 Kudos
Message 5 of 8
(409 Views)

@Bob_Schor wrote:


The Excel Easy Table function is polymorphic, accepting 2D arrays of Text or Dbl.


Didn't realize that, thanks for the info! (Funny that the input labeled "Text data" can accept numerical data :))

 

Digging into the toolkit, it uses "Array to Spreadsheet String" with a format specifier of %s. To be honest, I've never used "%s" to format a numeric value (and didn't even know it would work!). I'd suggest you try a simple example that converts an array of decimal data to an array of string data using Array to Spreadsheet String.vi with the code "%s" and see if it handles the decimal points correctly for your system.

 

If it doesn't, then an easy way to fix this would be to just manually convert your numerical data to text, then use the text version of Excel Easy Table. That way you can explicitly set which format codes you want to use.

 

(As an aside, do check on the "use system decimal point" thing, and make sure Excel uses the system decimal point as well.)

0 Kudos
Message 6 of 8
(397 Views)
Solution
Accepted by topic author MarceloPinto71

Thank you all for your help! Following what @BertMcMahan mentioned, I managed to solve the problem, transforming the numeric variables into strings. I used the "Number to fractional string" VI. Now the data is appearing correctly in the Excel template! Once again I thank all of you for your kindness and help!

0 Kudos
Message 7 of 8
(388 Views)
Solution
Accepted by topic author MarceloPinto71

No problem. Be sure to click "Mark as solution" next to the post(s) that helped you so future users with similar problems can find the answer.

0 Kudos
Message 8 of 8
(375 Views)