Indigo Rose Software

Professional Software Development Tools

 
+ Reply to Thread
Results 1 to 12 of 12
  1. #1
    Join Date
    Mar 2006
    Location
    Michigan
    Posts
    228

    Grin Grid Help Needed

    Is there a way to save the GRID without saving the top row (0).

    Trying to save a grid but don't want the top row saved.

    Using the:
    bSave = Grid.SaveToFile("Grid1", "AutoPlay\\Docs\\Text.cvs", ",");
    does not give any control on what is saved.

    Any Suggestions ?

    Thanks..

  2. #2
    Join Date
    May 2006
    Posts
    5,380
    loop through the grid items, save each row as a line of text

    something like this should work (UNTESTED CODE)
    Code:
    function SaveGridRowsToFile(sGrid, sFile)
    
    	local nRowCount = Grid.GetRowCount(sGrid);
    	local nColCount = Grid.GetColumnCount(sGrid)
    	
    	if nRowCount > 0 and nColCount > 0 then
    		for nRow=1, nRowCount do
    			local sRowText=""
    			for nCol=0, nColCount do
    				local sItem = Grid.GetCellText(sGrid, nRow, nCol)
    				sRowText=sRowText..sItem
    			end
    			TextFile.WriteFromString(sFile, sRowText, true);
    		end
    	end
    
    end
    
    
    SaveGridRowsToFile("Grid1", "C:\\MyFile.txt")
    but i havent got time to test it
    Open your eyes to Narcissism, Don't let her destroy your life!!

  3. #3
    Join Date
    Jan 2001
    Location
    Anderson Island, WA, USA
    Posts
    2,863
    You, of course, will want to change
    sRowText=sRowText..sItem

    to format it -- such as;
    sRowText=sRowText..", "..sItem


    (Click here to contact me)
    Providing Independent Professional Consulting Services for
    IndigoRose products, World Wide.
    Located in -8:00 (-7:00 DST) GMT Timezone (Western United States)

  4. #4
    Join Date
    May 2006
    Posts
    5,380
    yup, i did say it was untested!
    Open your eyes to Narcissism, Don't let her destroy your life!!

  5. #5
    Join Date
    Jan 2001
    Location
    Anderson Island, WA, USA
    Posts
    2,863
    The nice thing about aircode is it's fun to find out your code was perfect -- an air-code review (I didn't compile it) says it look good -- just that one bit. I'm always impressed when I get aircode 100% (which isn't as often as my ego thinks it is)


    (Click here to contact me)
    Providing Independent Professional Consulting Services for
    IndigoRose products, World Wide.
    Located in -8:00 (-7:00 DST) GMT Timezone (Western United States)

  6. #6
    Join Date
    May 2006
    Posts
    5,380
    get aircode 100%, i test code and its still not 100%, to eager to post sometimes and miss the obvious....how could i forget the d.a.m delimiter

    the "UNTESTED CODE" is just insurance against "IT DON'T WORK", and anyway......the OP learns something trying to fix my code, lol

    which isn't as often as my ego thinks it is
    lol, yea, me too, if i was as good as my ego thinks i am id be working at MicroShaft by now!
    Open your eyes to Narcissism, Don't let her destroy your life!!

  7. #7
    Join Date
    Mar 2006
    Location
    Michigan
    Posts
    228

    Thumbs up Grid Example

    About Grid Example. I am a newbie and had a bit of a problem with the Grid.
    I did not find much help for it either in the forums. So I found the example
    called TextFile2Grid and expaned on it a little.
    Also I would like to thank RizlaUK for the help he gave me on saving the grid
    without row Zero. It did not work the best but sure lead me in the right
    direction and I was able to fix it. So because of not much about the Grid for
    examples I wrote this.

    I Hope this little program is a help to others.

    Anyone can use this as they see fit.

    JerryAB

    See Attached ****
    Attached Files

  8. #8
    Join Date
    May 2006
    Posts
    5,380
    Hey, for a newbie that's a pretty good example, you should also post it in the examples forum so other users can find it with ease

    Well Done and keep up the good work
    Open your eyes to Narcissism, Don't let her destroy your life!!

  9. #9
    Join Date
    Mar 2006
    Location
    Michigan
    Posts
    228

    Smile Thank You RizlaUK

    I did as you suggested and sent it to the examples forum. I guess it has to be checked out before it gets posted.

    Anyway thank you for the compliment. I know I need alot more pratice
    cause I really hate to do documentation and still need to get down the
    proper way to code. All in time I guess. I figured it was good enough
    for others to get something out of it anyway.

    JerryAB

  10. #10
    Join Date
    May 2006
    Posts
    5,380
    i like to see someone at least try, there are some users that have been asking stupid questions for the last 4 years....they learn nothing, its nice when people show a willingness to learn

    in 2 years you will look at the code you write now and think "man, iv learned so much", i know i did, and still learning
    Open your eyes to Narcissism, Don't let her destroy your life!!

  11. #11
    Join Date
    Oct 2009
    Location
    Merton, United Kingdom
    Posts
    684
    Quote Originally Posted by RizlaUK View Post
    in 2 years you will look at the code you write now and think "man, iv learned so much", i know i did, and still learning
    That is too true.

  12. #12
    Join Date
    Mar 2006
    Location
    Michigan
    Posts
    228

    Post Grid Example Update

    Well here I go again. The more I looked at my little app the more something
    did not look right. Well here is a new update Grid Examples v1.01.

    I added a button to save data to a chosen record.

    Now that is all I'm going to do to this Example as I think it says alot about
    it's self and some usefull code for beginers.

    I say done UnLess..... bla, bla, bla
    I'm sure all you have been there done that...

    Thanks ALL again for the help.

    For the newbies......... Have Fun.........

    JerryAB
    Attached Files
    Last edited by Jerryab; 03-11-2010 at 10:57 AM. Reason: Missing App

Posting Permissions

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