SPONSORS:






User Tag List

Thanks Thanks:  0
Likes Likes:  0
Dislikes Dislikes:  0
Results 1 to 4 of 4
  1. #1
    Junior Member
    Join Date
    Jan 2011
    Posts
    26
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Add value to CSV file

    Hi,

    I am currently using the following script to add vlaue to datapool file to a particular coloumn and particular row.

    public boolean addDatapoolValues(String expected, String ColName,String Datapool, int Row)

    {

    DatapoolFactory factory = DatapoolFactory.get();
    String filename = Datapool;

    java.io.File TestData = new java.io.File((String) RationalTestScript.getOption(IOptionName.DATASTORE ),filename);

    IDatapool editPool = factory.loadForEdit(TestData, true);

    IDatapoolEquivalenceClass eClazz =(IDatapoolEquivalenceClass) editPool.getEquivalenceClass(0);

    IDatapoolRecord record = (IDatapoolRecord) eClazz.getRecord(Row);
    IDatapoolCell cell = (IDatapoolCell) record.getCell(ColName);
    cell.setCellValue(expected);
    factory.save(editPool);
    factory.unload(editPool);
    return true;

    }

    Can some one pls help me to edit the above script (Or any other new script) in order to add the value to CSV file.

  2. #2
    Member
    Join Date
    Jul 2009
    Location
    Hyderabad,INDIA
    Posts
    382
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Add value to CSV file

    Hi Anu,

    can you please elaborate your requirement..
    Thanks and Regards,
    Sathish

  3. #3
    Junior Member
    Join Date
    Jan 2011
    Posts
    26
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Add value to CSV file

    Hi Satish,

    Sorry! I should have mentioned it clearly.

    I am basically trying to capture a value from the application during run time. What I need is,I have to save this captured value from application in external CSV file during run time. In this case I am using external CSV file as datapool.

    I am able to save the value in datapool during runtime. The script which I have posted above is to update the datapool during runtime.

    I am looking for similar script to update the external CSV file during run time.

    Thanks
    Anusha

  4. #4
    Member
    Join Date
    Jul 2009
    Location
    Hyderabad,INDIA
    Posts
    382
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Total Downloaded
    0

    Re: Add value to CSV file

    Hi Anu,

    CSV file is normal text file. So we use fileWriter or FileoutPutStream APIS for modifying the csv file.

    <font class="small">Code:</font><hr /><pre>
    // Make one FileOutPutStream to your csv file and make one print Stream to that FileOutPutStream
    FileOutputStream fo = new FileOutputStream("fileName.csv");
    PrintStream out = new PrintStream(fo);

    //Now print the captured values to your csv file.

    out.print("Value1");
    out.print("delimiter , or ; or - etc");
    out.print("Value2");


    </pre><hr />

    Hope this helps you!!!
    Thanks and Regards,
    Sathish

 

 

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Search Engine Optimisation provided by DragonByte SEO v2.0.36 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Resources saved on this page: MySQL 11.54%
vBulletin Optimisation provided by vB Optimise v2.6.4 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
User Alert System provided by Advanced User Tagging v3.2.8 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
vBNominate (Lite) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Feedback Buttons provided by Advanced Post Thanks / Like (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Username Changing provided by Username Change (Free) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
BetaSoft Inc.
Digital Point modules: Sphinx-based search
All times are GMT -8. The time now is 05:29 AM.

Copyright BetaSoft Inc.