Indigo Rose Software

Professional Software Development Tools

 
Results 1 to 6 of 6
  1. #1
    Join Date
    Oct 2005
    Posts
    76

    load tab text file into datagrid help please

    hello guys.
    i have been supplied a set of datafiles , some only 60 listings , some over 3000 listings.

    i have the datagrid plugin and would like to load the data from the file into the datagrid.

    i know enough to manipulate data once its been added , adding vat etc but i get so lost as to how to do 2 things.

    1st: load the data into the datagrid from the file thats tab delimited.(.txt)
    2nd:after my changes save the file back out as comma delimited. (.csv)

    i have attached the smallest sample data file i have , can someone please advise.

    Kind Regards
    Carl
    Attached Files

  2. #2
    Join Date
    Jul 2002
    Location
    USA
    Posts
    3,959
    I threw this together really quick, didn't do much error testing, but it should get you on track.
    Attached Files

  3. #3
    Join Date
    Sep 2002
    Location
    Sol 3
    Posts
    3,160
    I posted some functions a while back that allow you to import a csv file to a table. Might help get you started.

    Post

    Tigg
    TJ-Tigger
    "A common mistake that people make when trying to design something completely foolproof was to underestimate the ingenuity of complete fools."
    "Draco dormiens nunquam titillandus."
    Map of IR Forum Users - IR Project CodeViewer - Online Help - TiggTV - QuizEngine

  4. #4
    Join Date
    Oct 2005
    Posts
    76

    many thanks..

    hey worm and tj , many thanks for the help and advice , thats great , i was going round in small circles i know it wasnt going to be to much code , i just couldnt quite work it out

    changing/editing once in the datagrid is ok for me i just got stuck on the code for getting the data into the grid..

    i will now look at how to get it back out as a comma delimited csv

    Many thanks
    Kind regards
    carl

  5. #5
    Join Date
    Jul 2002
    Location
    USA
    Posts
    3,959
    A little starter code

    Code:
    sOut = ""
    for nRow = 1 , DataGrid.GetRowCount("Grid1") do
    	sLineOut = ""
    	for nCol =1, DataGrid.GetColumnCount("Grid1") do
    		sLineOut=sLineOut..DataGrid.GetCellText("Grid1", nRow, nCol)..","
    	end
    	sLineOut = String.Mid(sLineOut, 1, (String.Length(sLineOut) - 1)) .. "\r\n"
    	sOut  = sOut .. sLineOut
    end
    
    TextFile.WriteFromString("Autoplay\\Docs\\Output.csv", sOut, false)
    sOut = ""

  6. #6
    Join Date
    Dec 2003
    Location
    Location! Location!
    Posts
    6,137
    Quote Originally Posted by Worm View Post
    A little starter code

    Code:
    sOut = ""
    for nRow = 1 , DataGrid.GetRowCount("Grid1") do
    	sLineOut = ""
    	for nCol =1, DataGrid.GetColumnCount("Grid1") do
    		sLineOut=sLineOut..DataGrid.GetCellText("Grid1", nRow, nCol)..","
    	end
    	sLineOut = String.Mid(sLineOut, 1, (String.Length(sLineOut) - 1)) .. "\r\n"
    	sOut  = sOut .. sLineOut
    end
    
    TextFile.WriteFromString("Autoplay\\Docs\\Output.csv", sOut, false)
    sOut = ""
    Useful code chunk.
    Intrigued

Similar Threads

  1. Example: Loading Paragraph Text Using a Timer
    By Jonas DK in forum AutoPlay Media Studio 5.0 Examples
    Replies: 7
    Last Post: 11-25-2004, 05:10 PM
  2. Writing Text to a File
    By Desmond in forum AutoPlay Media Studio 5.0 Examples
    Replies: 0
    Last Post: 09-22-2003, 02:02 PM
  3. Licence and Scrolling Text Forms - Load text from file
    By alanK in forum Setup Factory 6.0
    Replies: 3
    Last Post: 03-01-2002, 08:31 AM
  4. Replies: 0
    Last Post: 08-17-2000, 02:29 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts