LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

how to make space between between two strings on generation report

Hello every one,

 It is to generate an excel report using generation report toolkit.  What I have tried  is  here attached with. I couldn't  make a space between each colulm data(strings) which is suppossed to be as equivalent as  the space between each header. On the other hand,  new excel file  is created  for each  data row where as I want to have just one excel file until the program is terminated. Would you help me as usaul please?

 Here  are my trial VI file and VI for DLL file attached with.

 

 Thank you lot 

Download All
0 Kudos
Message 1 of 8
(3,853 Views)

 The result for the excel file is also attached with

0 Kudos
Message 2 of 8
(3,849 Views)

You need to put the create new excel file and save excel file outside of the loop.  This is common logging technique, you will be using a lot of resources to open and close the file every time the while loop runs. Also im assuming that you want an empty column between each data column. You need to put the start of your data outside the while loop and then inside the while loop unbundle the data start cluster, add 2 to it, then rebundlle. 

 

See attached photo.



-Matt
0 Kudos
Message 3 of 8
(3,814 Views)

Dear Matt, thank you alot for your support. To creat a single excel file at each program start up, creatign new excel file and saving excel file outside of the loop  works for me, but  adding an empty column  between each data column couldn't work.

 Thank you again.

0 Kudos
Message 4 of 8
(3,736 Views)

you can have a try if it can help you.

0 Kudos
Message 5 of 8
(3,720 Views)

Your code suggests that you do not understand the Report Generation Toolkit and have confused "Excel" with "Spreadsheet".  Part of this is the confusion of having NI's "Write to Spreadsheet" VIs in the File Palette, which write CSV Files (or format data to be written in CSV format) and also the Report Generation Toolkit, which has "hooks" into Excel and actually writes .xlsx files.

 

Since you seem to know how to use the RGT, here's what I'd do:

  1. Remove all of the Write Spreadsheet functions (found on the File Palette).
  2. Outside the loop, issue the New Report and make it an Excel Report.
  3. Inside the loop, gather the data that you want to write into a 2D array (since that is what Easy Table requires).  Now you have a choice -- you can either gather all of the data into one large(r) 2D array, and do one Excel Easy Table (with Header array and a single 2D Data Array), which you can do after you exit the loop, or you can write the Table one row at a time.
  4. Suppose you want to write one row at a time.  Create a Shift Register to hold the Start coordinates (you'll see why in just a minute.  You don't (yet) need the Report File Path -- you'll do the actual Save Report when you exit the loop.  Also put the Array of Strings you want to use as a Row Header on a Shift Register (note -- "putting on a Shift Register" means you create a Shift Register and wire something to the outside to initialize the Shift Register).  Also, of course, since you did the New Report outside the loop, bring the Report Object wire (looks like a green chain) into the loop, again on a Shift Register.
  5. Now, inside your loop, gather the 1D array of data that you want to write into the first row.  You do not want to pass it through any string function, but want to keep it as a 1D array of Strings, or a 1D array of Numerics (whichever you prefer).  Since Easy Table expects a 2D array, pass this 1D array through a Build Array function to turn it into a 1-row, N-Column 2D array.
  6. Wire your Easy Table function with the following:  the Report Object Wire (from Shift Register), the Start location (from its Shift Register), your (now) 2D Data array (of a single row), the Error Line (of course), and (into the bottom connector) the Header from the Shift Register.
  7. Now wire the outputs to the corresponding Shift Registers, but do it carefully.  Report Object is easy.  There are two "next entry" outputs -- you want the first one, "Next row, bottom left" so that you write successive rows beneath each other.  Error Out is easy.  And for the remaining Shift Register, which was the Header, wire an empty Array of Strings (so you won't write headers on successive calls to this function).
  8. Finally, put the Save Report and Dispose Report functions (Dispose Report is what actually closes Excel -- you want to tell LabVIEW to close Excel rather than do it yourself, trust me on this) on the output side of the While loop.

Bob Schor

0 Kudos
Message 6 of 8
(3,699 Views)

I would like to extend a huge respect for the help. would mind sending me file with 2013  in case you have  labview  2013?.  Sorry! Mine is 2013.

Thank you a lot

0 Kudos
Message 7 of 8
(3,676 Views)

LabVIEW version was updated.

Download All
Message 8 of 8
(3,607 Views)