Writing a report file with specific information

Hi, all:
I need to write a text file with specific information in it. I'm going to copy it into Excel, so the easier the format, the better (perhaps CSV format?). I've never done this before, so here's the method I need to capture the information from:
     public void step() {
          greenColorStorage = new ArrayList();
          magentaColorStorage = new ArrayList();
          System.out.println( "==> Model step " + getTickCount() );// Checking step #
          for (int i = 0; i < soldierList.size (); i++) {
               Soldier s = (Soldier) soldierList.get (i);
               s.step();
          Collections.shuffle(soldierList);
          System.out.println("Shuffling collection now.");
          dsurf.updateDisplay ();
          System.out.println("Model.step() finished.");
          for (int i = 0; i < soldierList.size (); i++) {
               Soldier s = (Soldier) soldierList.get (i);
               if (s.getMyColor() == Color.green ) {
                    greenColorStorage.add(s);
               if (s.getMyColor() == Color.magenta ) {
                    magentaColorStorage.add(s);
          if (magentaColorStorage.size() == 0 || greenColorStorage.size() == 0 ) {
               stop();
     }In this method, I need to capture this information: There are soldiers on the Green team and on the Magenta team. I need to know how many there are originally, how many in this time step, at what time step the model stops, and how many of the winning color team are left when the model stops. How do I do this? If you can point me to a specific thread that shows how to write a report file like this, I'd be grateful, since I couldn't find one when I searched. Otherwise, I'd be grateful for examples. I'm in the middle of doing some research, and I have the feeling that I'll need to write report files in the future, so if you'd explain any code you provide, I would be quite grateful--I need to understand what I'm doing as well as simply using your code so that I can really learn what I'm doing when I do this again. Thanks very much!

FileOutputStream
public FileOutputStream(File file,
                        boolean append)
                 throws FileNotFoundException
Creates a file output stream to write to the file represented by the specified File object.
If the second argument is true, then bytes will be written to the end of the file
rather than the beginning.
*/

Similar Messages

  • How to create PDF from text file with specific layout?

    I wanted to create the pdf from text file in specific layout - Landscape orientation and JIS B3 Page size while at Adobe Acrobat Pro.
    In past, I could do a right click on a text file (desktop area) and select print to print out the document into .pdf BUT only if I set the Adobe PDF to Landscape and JIS B3 Page size BEFORE.  And I could only do 15 text documents at once.
    I wanted to see if I could do the create the pdf from text file with specific layout in Adobe Acrobat without having to go to Control Panel to preset the Adobe PDF to specific layout at every time.   I would have to set Adobe PDF back to normal layout after I'm done with these pdf print outs.  I do lots of pdfs in normal layout.  Sometimes I would forget to do that.
    So, How do I do that?

    No such luck.  It would output the contents in letter size even in JIS B3 Page layout at MS word. 
    Is there a script or action where I could set the orientation and page size before creating PDF on these text files?

  • Report file with cursor (RDF) to XMLP ! Help me !

    My report file (rdf) have not a SQL query, i used cursor to get data in database at runtime !
    It like:
    function QR_1RefCurDS return GetdataReport_PK.R11Curtype is
    rc GetdataReport_PK.R11Curtype;
    begin
    rc:=GetdataReport_PK.GL0200(:P_SOB,:P_BRANCH,:P_LEVEL,:P_DETAIL,:P_ACCT,:P_FROMDATE,:P_TODATE,:P_SEGMENT,:P_SEG_VALUE);
    return rc;
    end;
    I run report file with postscrip output, archived data is ok !
    But when i run this report file with xml output, no data archived !
    Please tell me how to used this report (rdf) with xml output
    Sorry, my english is not good !

    Hi Tim !
    Could you help me please !
    Please mail to me with add: [email protected] or [email protected]
    I have somethings and files want to send to you, such as rfd files and my package !
    After you see my rfd files i think you can give me some advice !
    Thanks !

  • Protecting text files with sensitive information

    I have an app where users log in and upload files with very
    sensitive information (pdf's or word doc's). Depending on the
    permissions an user can open and view or save specific files. I'm
    saving files out of the web server folder and using middle cfm
    page(docs.cfm) as a wrapper:
    Link to the docs.cfm:
    <a href="##"
    onClick="MM_openBrWindow('docs.cfm?name=#docFile#','fileDoc','scrollbars=yes,resizable=ye s,width=750,height=550')">#docName#</a>
    and here is docs.cfm code:
    <cfheader name="Content-Disposition" value="attachment;
    filename=#URL.name#">
    <cfcontent type="application/unknown"
    file="#Application.docsPath##URL.name#" reset="yes">
    Application.docsPath variable points to D:\myFiles\ folder
    (not in the web server directory).
    It is sill possible to open file if you guess the file name.
    Is it any way to protect files from unauthorized users and to
    block them if they try to guess and open a file?
    Thanks,
    b.

    I think the best way to protect them would be to store them
    in a database and
    restrict access to the database. The database should also be
    outside the DMZ.
    SQL 2005 has some field level encryption if you want to get
    supper protective,
    but that has some limits of data length that you'll need to
    work around. We
    encrypyt user passwords with SQL 2005 and it works great.
    More info here:
    http://blogs.msdn.com/yukondoit/archive/2005/11/24/496521.aspx
    The other possible solution is to place all a user's files
    into 1 zip file and
    encrypt and password protect it, not as secure, but would
    work. You could use
    their userid and email or something for unique username's and
    passwords per
    file. Each user would have their own zip that you unzippped
    to give them access
    to what was inside. When they uploaded the file, you just add
    it to the zip.
    This way you could allow them to upload differant types of
    files and handle
    them all the same way.

  • Writing binary to file with 24 or 32-bit numbers

    I am using an NI4472 DAQ to sample some analog data at 24-bits and I want to write the data to disk. However LabView only has a VI to write 16-bit data to disk. Is there a way to write 24 or 32 bit binary numbers to a file?

    The VI you are looking at is probably one of the "Easy VIs" that is setup for a specific application. You can create more general programs to write a binary file with any data type you desire. I would recommend taking a look at the Write Binary File example that ships with LabVIEW. It shows a more general approach to writing data to a binary file. In this example they write double precision numbers but you could easily replace the data with I32s.

  • Report Header with Member Information and body with claim information

    So we are designing this report that has Member Information in the Header of the SSRS Report and it's in the header because we want the member information to repeat on each individual page to identify who it belongs to. Within the report we want to report
    on all the claims for that member. Now our business user does not want the claim data as a tablix because the amount of claim information they're asking for is just too long. What I'd like to do is for each claim put a data label followed by its corresponding
    data...kind of an old fashioned report.
    So obviously I'd like to control the amount of claim information so that each page will hous an individual claim.
    What is the best way to do this? With a Subreport?
    Thanks for your review and am hopeful for a reply.
    ITBobbyP85

    Hi ,
    You can achieve this using below;
    1.Insert one List Control in Report Area.
    2.Delete Details from Row Group Area.
    3.Group by on Row Group "claim Name" .
    4.Delete Column from Tablix that is used fro "Claim Name" .use Delete Columns Only.
    5. Right Click on Claim Name Group -> Group Properties-> Page Break ->Between each Instance of Group.
    6.In Tablix -> Right Click on Row ->Insert row-> Inside group below
    7. now you have skeleton use upper cell for Report Header that will be Claim Name in your Case.
    8. Drag one Tablix in Second Cell -> Bind data you require
    Please share if you have any issue.
    Thanks
    Please Mark This As Answer or vote for Helpful Post if this helps you to solve your question/problem.

  • Open vi file with specific Labview version using batch file (Windows)

    I want to open certain vi with using Windows batch file and to use specific version of Labview development system. I tried
    "C:\Program Files (x86)\National Instruments\LabVIEW 2012\LabVIEW.exe" "path_to_vi"
    "C:\Program Files\National Instruments\LabVIEW 2012\LabVIEW.exe" "path_to_vi"
    to use 32-bit and 64-bit development systems respectively. However Labview opens file with version which was last used before. Are there any ways to force it use specified version?

    No, it's a VI I wrote so that when I open any VI from Windows Explorer it will open it in correct version of LabVIEW according to it's source version (rather than the latest/last version of LabVIEW I opened). All it does to launch the right version of LabVIEW is to call System Exec with the path to the correct version of the LabVIEW.exe and the path to the VI - which is essentially the same as what your batch file is doing.
    Certified LabVIEW Architect, Certified TestStand Developer
    NI Days (and A&DF): 2010, 2011, 2013, 2014
    NI Week: 2012, 2014
    Knowledgeable in all things Giant Tetris and WebSockets

  • Help in writing to a file with newline facility

    I am using the RandomAccessFile class to write to a file.
    The content i am writing to the file is of the form
    KEY=VALUE.
    I am writing several key value pairs like this.
    Everytime I write a KEY=VALUE it should be in a new line.
    So, what should i do to write in a new line everytime.
    Please help.
    Thanks in advance.

    Well the square most likely is just a non-printable character. If you are on windows the line.separator is \r\n (0x13 and 0x10) some file editors show the \n as a "square" as the only expect a \r its just how you interpret the file.. you can't atually do anythign about it as it isn't "wrong" if you skip the \n some programs might not see it as a newline. If you add it some may display a square.. Its the great gift of different OS's using different line separators..
    HTH
    Lima

  • Writing to file with specific encoding in unix

    hi,
    I want to write html files which contain Turkish characters in unix operating system.
    I'm currently using FileWriter to write the files.
    I'm getting the file content from the database and I can see that the characters seem to be fine but when I write them into an html file, they are displayed with the question mark character (?).
    What can I do about this?
    Thanks

    FileWriter uses the default character encoding of whatever platform your program is running on. Beside the fact that the default encoding may vary from one machine to another, it may not be suitable for storing non-ASCII (Turkish) characters.
    Rather than using FileWriter, you can use an OutputStreamWriter and a FileOutputStream, which allows you to specify the character encoding you want. UTF-8 is generally a good choice, since it can encode just about anything. For example:FileOutputStream fos = new FileOutputStream("/some/file/name");
    OutputStreamWriter osw = new OutputStreamWriter(fos, "utf-8");
    osw.write("your text with Turkish characters...");Geoff

  • Importing data from third party file with specific layout

    Hello everyone,
    I have been searching the forum and googling for help on this but so far no success.
    The issue I have is the following:
    - I need my client to provide data to me in 2 different dates (Date 1 and Date 2), for example, a bank account balance;
    - He has already provided me with data for "Date 1" in the previous year and this information is stored in a file, generated by a government software;
    - I have the file layout provided by the government, establishing the location and number of characters where the information is stored (e.g. need to import characters 4-12 of a specific line in the file);
    - I need to be able to read from this file and pre-populate field "Date 1" with the amounts informed previously;
    - I will then send a PDF form for him to update the "Date 2" field, using the amount in "Date 1" as a reference.
    Is there any way I can do this?
    I like researching and do this as a hobby, therefore I don't expect to receive pieces of code already prepared - I would just appreciate if anyone could point me in the right direction here, as my coding skills are from a guy interested in learning things.
    Many thanks in advance for all the help.
    P.S.: the government software can generate a .PDF file and the data I need is reported there, just in case it is easier to work with a PDF file instead.

    Hi,
    Looks like that you are using relative path. Then, the file must be located in MathScript search path. Otherwise, MathScript can not find that file. You can either specify the absolute path or add the path to MathScript search path list.
    I have tried in LabVIEW 8.6. dlmread should work well to read data from .txt file.

  • HOW TO: Open SQL Developer from a batch file with specific tables opened

    I use SQL Developer daily as I develop database intensive programs.
    ** Question **
    How can I define a specific configuration of tabs (i.e. tables, procedures, etc) to be opened upon startup of SQL Developer?
    For example, creating a .BAT file to open SQL Developer with a specific set of table tabs already opened. This will save me the time every morning I use to open SQL Developer and configure all the tables I need opened.
    NOTE: I have tried various options of appending a table name to a command line starting sqldeveloper.exe. For example: ..\sqldeveloper.exe mydatabase.mytable. However, this only opens a worksheet tab with the name "mydatabase.mytable" but does not open my actual table.
    Any help will be appreciated.
    - Gary Davis

    what version are you using? Sql Dev 1.5?
    Not an exact answer, but you could try using Table FILTER
    click on your connection
    right button on TABLES
    click apply filter
    as for your question, check out:
    Re: EA1 - Automatically open connection list at startup?
    or
    SQL Developer

  • Export DNG file with copyright information

    When importing my Canon CR2 RAW files, I convert them to DNG files into a folder with that days date, and automatically add my copyright information on import.
    If there are any photos I want to process further I'll export them to a working folder, still as a DNG file. In the export dialogue box I can't seem to be able to include all metadata information - including the copyright information.
    Will Lightroom allow me to do this? Or when exporting to my working folder, do I need to convert these files to TIFF?
    Cheers.

    When you export to DNG you don't have the option to select which metadata to export (the dialog box is grayed-out, and it defaults to All Metadata). you just export every single metadata you already have in you master file.

  • Uploading data file with specific encoding and other metadata

    Hello everyone.
    I've been recently testing Microsoft Codename "Data Hub". When select the option to upload a CSV or XLSX file to populate my database, it basically has two problems, in my opinion:
    1. It would be great if I could select the file's encoding. If my file is in Spanish, it won't properly load latin characters (e.g. accents, or special characters). The information ends up showing with a bunch of weird characters.
    2. It also doesn't let me select which character to use as data separator. It uses the comma as the default. Some of the data might contain commas, so I usually change the separator to a pipe in my CSV files.
    Does anybody know any workarounds?
    Thanks.

    Hey there, and apologies.  I wanted to reach out and see if this is still a problem for you.
    I also wanted to check if this is a question about Azure SQL Database or something else?
    Thanks Guy

  • What VI can read raw data from a TDMS file with scaling information entered?

    I would like to use scaling with my TDMS files so that the end user will
    only see engineering unit values, however, within my Labview application, I
    want to retrieve the raw data.  Is there a way to read the raw data using
    one of the Vi's in Labview?

    The scaling information in a TDMS file is stored as properties of the channel.  One trick (that I haven't mastered yet) is you can change the properties of the TDMS file (set properties) and set all the scales to have a offset of 0 and a scale of 1.  This will apply a scale that has the engineering units be the same as the raw values.  Then you can read the data like normal and you'll get the raw values.
    There are several issues to be aware of, the first is changing the scale and forgetting to change it back, or some how modifying the data to be incorrect units and not knowing it.  For this reason I'd recommend making a copy of the TDMS file to a temporary location to make the modifications to the properties, read it, then delete the temporary TDMS file when you are done.  
    This is the only way I know of to get the raw readings from a scaled TDMS channel.  
    Unofficial Forum Rules and Guidelines - Hooovahh - LabVIEW Overlord
    If 10 out of 10 experts in any field say something is bad, you should probably take their opinion seriously.

  • OSB file Write, not naming the file with specific name.

    Hi ALL,
    I have a requirement, i should accept the data or XML file from from JMs queue and place it in a location specified. For this i have build the PS and BS.
    Where PS will De-queue the JMS queue and route using Service call out to BS. And the BS will place the file in location. I could do this easily. BUT the thing is that i could not name the file perfectly with the intended file name. to build the BS i used .JCA file , .WSDL file, XML file from Jdeveloper. and imported to osb console. i could write the file as follows..
    MY business Services:
    services TYPE : ANY XML services
    transport
    Protocol ==> file
    Load Balancing Algorithm ==> round-robin
    Endpoint URI ==> file:///oracle/Middleware/user_projects/domains/Agile
    Request encoding ==> utf-8
    this is the file name i am getting:
    <con:metadata      xmlns:con="http://www.bea.com/wli/sb/test/config">
         <tran:response-code      xmlns:tran="http://www.bea.com/wli/sb/transports">0</tran:response-code>
         <tran:encoding      xmlns:tran="http://www.bea.com/wli/sb/transports">utf-8</tran:encoding>
         <file:filePath      xmlns:file="http://www.bea.com/wli/sb/transports/file">
         /oracle/Middleware/user_projects/domains/Agile/POTest3338620552690675292--411054fa.1363686ca89.3e8d.xml
         </file:filePath>
    </con:metadata>
    the file NAME : POTest3338620552690675292--411054fa.1363686ca89.3e8d.xml ( POTest is prefix and .xml is Sufix)
    3338620552690675292--411054fa.1363686ca89.3e8d i dont know y the this garbage file name is created...
    please give suggestions to avoid garbage name
    thanks --
    ANIL

    Hi ALL,
    I have a requirement, i should accept the data or XML file from from JMs queue and place it in a location specified. For this i have build the PS and BS.
    Where PS will De-queue the JMS queue and route using Service call out to BS. And the BS will place the file in location. I could do this easily. BUT the thing is that i could not name the file perfectly with the intended file name. to build the BS i used .JCA file , .WSDL file, XML file from Jdeveloper. and imported to osb console. i could write the file as follows..
    MY proxy services:
    services type : any XML services
    protocol :jms
    MY business Services:
    services TYPE : ANY XML services
    transport
    Protocol ==> file
    Load Balancing Algorithm ==> round-robin
    Endpoint URI ==> file:///oracle/Middleware/user_projects/domains/Agile
    Request encoding ==> utf-8
    this is the file name i am getting:
    <con:metadata xmlns:con="http://www.bea.com/wli/sb/test/config">
    <tran:response-code xmlns:tran="http://www.bea.com/wli/sb/transports">0</tran:response-code>
    <tran:encoding xmlns:tran="http://www.bea.com/wli/sb/transports">utf-8</tran:encoding>
    <file:filePath xmlns:file="http://www.bea.com/wli/sb/transports/file">
    /oracle/Middleware/user_projects/domains/Agile/POTest3338620552690675292--411054fa.1363686ca89.3e8d.xml
    </file:filePath>
    </con:metadata>
    the file NAME : POTest3338620552690675292--411054fa.1363686ca89.3e8d.xml ( POTest is prefix and .xml is Sufix)
    3338620552690675292--411054fa.1363686ca89.3e8d i dont know y the this garbage file name is created...
    i am getting this error when i process test from proxy services then i may use route and change it as Use Routing Options on the Service Callout and override the header (jca.file.FileName).
    but the thing is when i test from Business services also i am getting the same garbage name on both window and linux.
    please give suggestions to avoid garbage name
    thanks --
    ANIL

Maybe you are looking for