Loading ...
Sorry, an error occurred while loading the content.
 

Re: ten thousand questions about LB

Expand Messages
  • gpop_520
    I ll have to go back and see what s going on. I really appreciate your help. Thanks.
    Message 1 of 12 , Sep 3, 2010
      I'll have to go back and see what's going on. I really appreciate your help. Thanks.

      --- In libertybasic@yahoogroups.com, "John" <john_siejkowski@...> wrote:
      >
      > I was trying to address your comment that using the "PUT" statement does not overwrite the existing record but "inserts" it and bumps all the other records up. I use a lot of RAF files and have never seen it do that. The example I have below puts 3 words into the datafile, then goes back and puts a new word in place of record #2. This action does not cause the exisiting words to "bump up" but simply overwrites the word "Two" as expected. Do you get the same result as me? I've not been able to duplicate what you've described and I've actually had to write code to intentionally perform that same action when I needed it.
      >
      > 'Code starts
      > 'watch for line wraps
      >
      >
      >
      > numbers$="One Two Three"
      >
      > open "RAFile.txt" for random as #checks len=20
      > field #checks,_
      > 20 as name$,_
      >
      > for recID = 1 to 3
      > name$= word$(numbers$,recID) 'put simple words into file
      > put #checks,recID 'as records 1,2,3
      > NumRecords=lof(#checks)/20
      > print NumRecords
      > next recID
      >
      > name$="Four"
      > put #checks, 2 'update second record to word "Four"
      > NumRecords=lof(#checks)/20
      > print NumRecords
      > close #checks
      > end
      >
      > 'Code ends
      >
      > John "Psycho" Siejkowski
      >
      > --- In libertybasic@yahoogroups.com, "Ingemar Bjerle" <ingbje@> wrote:
      > >
      > >
      > > 'Every time you add a new record NumRecords increases with one.
      > >
      > > NumRecords = lof(#checks)/115 ' this line calculates the NumRecords value
      > > for rec = 1 to NumRecords
      > > gettrim #checks, rec
      > > NAMES$(rec) = name$
      > > next rec
      > >
      > > Your program is as I see only handling one single record as NumRecord stays at one all the time.
      > > You say you are inserting (I call that "update" and the NumRecords does not change) and when I increase NumRecords I call that "add"
      > > When update is performed NumRecords stays constant.
      > >
      > > In programs with a RAF-file I always have an add-button and a update button
      > >
      > > [add]
      > > recNum = lof(#checks) /115 + 1 ' calc location of record to add
      > > put #checks, recNum
      > > wait
      > > [update]
      > > put #checks, recNum
      > > wait
      > >
      > > kind regards
      > > Ingemar
      > >
      > > ----- Original Message -----
      > > From: John
      > > To: libertybasic@yahoogroups.com
      > > Sent: Friday, September 03, 2010 12:34 AM
      > > Subject: [libertybasic] Re: ten thousand questions about LB
      > >
      > >
      > >
      > >
      > >
      > > --- In libertybasic@yahoogroups.com, "gpop_520" <gpop_520@> wrote:
      > > >
      > > >
      > > >
      > > > --- In libertybasic@yahoogroups.com, "Stefan Pendl" <pendl2megabit@> wrote:
      > > > >
      > > > > > >
      > > > > > > PUT does overwrite the record as to my observations, I have
      > > > > > never had a RAF act differently.
      > > > > > >
      > > > > >
      > > > > > ' data is selected via a combobox and the record number is read
      > > > > >
      > > > > > #chkwin.list "selectionindex? recID"
      > > > > >
      > > > >
      > > > > ---snip
      > > > >
      > > > > >
      > > > > > ' And the resulting fields are PUT to the file with the designated
      > > > > > ' recID.
      > > > > >
      > > > > > put #checks,recID
      > > > > >
      > > > > > ' The added record does not overwrite the existing record but is
      > > > > > ' inserted.
      > > > > >
      > > > >
      > > > > Do you fill the combo box array starting as index zero, if so, your returned index is wrong, since it is one-based.
      > > > >
      > > > > You are encouraged to not use the zero index with combo and list boxes, which is mentioned in the help file.
      > > > >
      > > > > ---
      > > > > Stefan Pendl
      > > > > http://stefanpendl.runbasichosting.com/
      > > > >
      > > > No, the NAME$ array used below to populate the combobox is populated starting with index 1:
      > > >
      > > > combobox #chkwin.list, NAMES$(), [selectionmade], boxx, boxy - 25, 300, 20
      > > >
      > > > for rec = 1 to NumRecords
      > > > gettrim #checks, rec
      > > > NAMES$(rec) = name$
      > > > next rec
      > > >
      > >
      > > Does this alteration of your code result in only 1 entry?
      > > I used static data but "PUT" it into the datafile 3 times and I only show 1 entry indicating the original was replaced rather than being inserted and older ones pushed up.
      > >
      > > 'Code Start
      > >
      > > for x = 1 to 3
      > >
      > > open "C:\Liberty BASIC v4.04\file.txt" for random as #checks len=115
      > > field #checks,_
      > > 60 as name$,_
      > > 2 As month$,_
      > > 2 as day$,_
      > > 4 as year$,_
      > > 5 as dollars$,_
      > > 2 as cents$,_
      > > 40 as memo$
      > >
      > > ' data is selected via a combobox and the record number is read
      > >
      > > ' data is retrieved from one combo box and several text boxes
      > > ' if a change was made
      > > name$= "name field"
      > > month$="09"
      > > day$="02"
      > > year$="2010"
      > > dollars$="123"
      > > cents$="45"
      > > memo$="looped 3 times but only 1 entry"
      > >
      > > ' And the resulting fields are PUT to the file with the designated
      > > ' recID.
      > >
      > > put #checks,1
      > > close #checks
      > >
      > > next x
      > >
      > > 'Code ends
      > >
      > > John "Psycho" Siejkowski
      > >
      > > end
      > >
      > >
      > >
      > >
      > >
      > > [Non-text portions of this message have been removed]
      > >
      >
    • gpop_520
      I m not sure I see what you are saying, because NumRecords is not remaining at one. If it were at one, I would see multiple elements in the combobox. Either
      Message 2 of 12 , Sep 3, 2010
        I'm not sure I see what you are saying, because NumRecords is not remaining at one. If it were at one, I would see multiple elements in the combobox.
        Either way, I'm doing something wrong, as no one has the same issue. I'll go back to it and see.
        Appreciate you help.
        John

        --- In libertybasic@yahoogroups.com, "Ingemar Bjerle" <ingbje@...> wrote:
        >
        >
        > 'Every time you add a new record NumRecords increases with one.
        >
        > NumRecords = lof(#checks)/115 ' this line calculates the NumRecords value
        > for rec = 1 to NumRecords
        > gettrim #checks, rec
        > NAMES$(rec) = name$
        > next rec
        >
        > Your program is as I see only handling one single record as NumRecord stays at one all the time.
        > You say you are inserting (I call that "update" and the NumRecords does not change) and when I increase NumRecords I call that "add"
        > When update is performed NumRecords stays constant.
        >
        > In programs with a RAF-file I always have an add-button and a update button
        >
        > [add]
        > recNum = lof(#checks) /115 + 1 ' calc location of record to add
        > put #checks, recNum
        > wait
        > [update]
        > put #checks, recNum
        > wait
        >
        > kind regards
        > Ingemar
        >
        > ----- Original Message -----
        > From: John
        > To: libertybasic@yahoogroups.com
        > Sent: Friday, September 03, 2010 12:34 AM
        > Subject: [libertybasic] Re: ten thousand questions about LB
        >
        >
        >
        >
        >
        > --- In libertybasic@yahoogroups.com, "gpop_520" <gpop_520@> wrote:
        > >
        > >
        > >
        > > --- In libertybasic@yahoogroups.com, "Stefan Pendl" <pendl2megabit@> wrote:
        > > >
        > > > > >
        > > > > > PUT does overwrite the record as to my observations, I have
        > > > > never had a RAF act differently.
        > > > > >
        > > > >
        > > > > ' data is selected via a combobox and the record number is read
        > > > >
        > > > > #chkwin.list "selectionindex? recID"
        > > > >
        > > >
        > > > ---snip
        > > >
        > > > >
        > > > > ' And the resulting fields are PUT to the file with the designated
        > > > > ' recID.
        > > > >
        > > > > put #checks,recID
        > > > >
        > > > > ' The added record does not overwrite the existing record but is
        > > > > ' inserted.
        > > > >
        > > >
        > > > Do you fill the combo box array starting as index zero, if so, your returned index is wrong, since it is one-based.
        > > >
        > > > You are encouraged to not use the zero index with combo and list boxes, which is mentioned in the help file.
        > > >
        > > > ---
        > > > Stefan Pendl
        > > > http://stefanpendl.runbasichosting.com/
        > > >
        > > No, the NAME$ array used below to populate the combobox is populated starting with index 1:
        > >
        > > combobox #chkwin.list, NAMES$(), [selectionmade], boxx, boxy - 25, 300, 20
        > >
        > > for rec = 1 to NumRecords
        > > gettrim #checks, rec
        > > NAMES$(rec) = name$
        > > next rec
        > >
        >
        > Does this alteration of your code result in only 1 entry?
        > I used static data but "PUT" it into the datafile 3 times and I only show 1 entry indicating the original was replaced rather than being inserted and older ones pushed up.
        >
        > 'Code Start
        >
        > for x = 1 to 3
        >
        > open "C:\Liberty BASIC v4.04\file.txt" for random as #checks len=115
        > field #checks,_
        > 60 as name$,_
        > 2 As month$,_
        > 2 as day$,_
        > 4 as year$,_
        > 5 as dollars$,_
        > 2 as cents$,_
        > 40 as memo$
        >
        > ' data is selected via a combobox and the record number is read
        >
        > ' data is retrieved from one combo box and several text boxes
        > ' if a change was made
        > name$= "name field"
        > month$="09"
        > day$="02"
        > year$="2010"
        > dollars$="123"
        > cents$="45"
        > memo$="looped 3 times but only 1 entry"
        >
        > ' And the resulting fields are PUT to the file with the designated
        > ' recID.
        >
        > put #checks,1
        > close #checks
        >
        > next x
        >
        > 'Code ends
        >
        > John "Psycho" Siejkowski
        >
        > end
        >
        >
        >
        >
        >
        > [Non-text portions of this message have been removed]
        >
      • gpop_520
        As I said to the others, I must be doing something wrong. I ll go back and play with. Thank you for taking the time. John
        Message 3 of 12 , Sep 3, 2010
          As I said to the others, I must be doing something wrong. I'll go back and play with. Thank you for taking the time.
          John

          --- In libertybasic@yahoogroups.com, "John" <john_siejkowski@...> wrote:
          >
          > I was trying to address your comment that using the "PUT" statement does not overwrite the existing record but "inserts" it and bumps all the other records up. I use a lot of RAF files and have never seen it do that. The example I have below puts 3 words into the datafile, then goes back and puts a new word in place of record #2. This action does not cause the exisiting words to "bump up" but simply overwrites the word "Two" as expected. Do you get the same result as me? I've not been able to duplicate what you've described and I've actually had to write code to intentionally perform that same action when I needed it.
          >
          > 'Code starts
          > 'watch for line wraps
          >
          >
          >
          > numbers$="One Two Three"
          >
          > open "RAFile.txt" for random as #checks len=20
          > field #checks,_
          > 20 as name$,_
          >
          > for recID = 1 to 3
          > name$= word$(numbers$,recID) 'put simple words into file
          > put #checks,recID 'as records 1,2,3
          > NumRecords=lof(#checks)/20
          > print NumRecords
          > next recID
          >
          > name$="Four"
          > put #checks, 2 'update second record to word "Four"
          > NumRecords=lof(#checks)/20
          > print NumRecords
          > close #checks
          > end
          >
          > 'Code ends
          >
          > John "Psycho" Siejkowski
          >
          > --- In libertybasic@yahoogroups.com, "Ingemar Bjerle" <ingbje@> wrote:
          > >
          > >
          > > 'Every time you add a new record NumRecords increases with one.
          > >
          > > NumRecords = lof(#checks)/115 ' this line calculates the NumRecords value
          > > for rec = 1 to NumRecords
          > > gettrim #checks, rec
          > > NAMES$(rec) = name$
          > > next rec
          > >
          > > Your program is as I see only handling one single record as NumRecord stays at one all the time.
          > > You say you are inserting (I call that "update" and the NumRecords does not change) and when I increase NumRecords I call that "add"
          > > When update is performed NumRecords stays constant.
          > >
          > > In programs with a RAF-file I always have an add-button and a update button
          > >
          > > [add]
          > > recNum = lof(#checks) /115 + 1 ' calc location of record to add
          > > put #checks, recNum
          > > wait
          > > [update]
          > > put #checks, recNum
          > > wait
          > >
          > > kind regards
          > > Ingemar
          > >
          > > ----- Original Message -----
          > > From: John
          > > To: libertybasic@yahoogroups.com
          > > Sent: Friday, September 03, 2010 12:34 AM
          > > Subject: [libertybasic] Re: ten thousand questions about LB
          > >
          > >
          > >
          > >
          > >
          > > --- In libertybasic@yahoogroups.com, "gpop_520" <gpop_520@> wrote:
          > > >
          > > >
          > > >
          > > > --- In libertybasic@yahoogroups.com, "Stefan Pendl" <pendl2megabit@> wrote:
          > > > >
          > > > > > >
          > > > > > > PUT does overwrite the record as to my observations, I have
          > > > > > never had a RAF act differently.
          > > > > > >
          > > > > >
          > > > > > ' data is selected via a combobox and the record number is read
          > > > > >
          > > > > > #chkwin.list "selectionindex? recID"
          > > > > >
          > > > >
          > > > > ---snip
          > > > >
          > > > > >
          > > > > > ' And the resulting fields are PUT to the file with the designated
          > > > > > ' recID.
          > > > > >
          > > > > > put #checks,recID
          > > > > >
          > > > > > ' The added record does not overwrite the existing record but is
          > > > > > ' inserted.
          > > > > >
          > > > >
          > > > > Do you fill the combo box array starting as index zero, if so, your returned index is wrong, since it is one-based.
          > > > >
          > > > > You are encouraged to not use the zero index with combo and list boxes, which is mentioned in the help file.
          > > > >
          > > > > ---
          > > > > Stefan Pendl
          > > > > http://stefanpendl.runbasichosting.com/
          > > > >
          > > > No, the NAME$ array used below to populate the combobox is populated starting with index 1:
          > > >
          > > > combobox #chkwin.list, NAMES$(), [selectionmade], boxx, boxy - 25, 300, 20
          > > >
          > > > for rec = 1 to NumRecords
          > > > gettrim #checks, rec
          > > > NAMES$(rec) = name$
          > > > next rec
          > > >
          > >
          > > Does this alteration of your code result in only 1 entry?
          > > I used static data but "PUT" it into the datafile 3 times and I only show 1 entry indicating the original was replaced rather than being inserted and older ones pushed up.
          > >
          > > 'Code Start
          > >
          > > for x = 1 to 3
          > >
          > > open "C:\Liberty BASIC v4.04\file.txt" for random as #checks len=115
          > > field #checks,_
          > > 60 as name$,_
          > > 2 As month$,_
          > > 2 as day$,_
          > > 4 as year$,_
          > > 5 as dollars$,_
          > > 2 as cents$,_
          > > 40 as memo$
          > >
          > > ' data is selected via a combobox and the record number is read
          > >
          > > ' data is retrieved from one combo box and several text boxes
          > > ' if a change was made
          > > name$= "name field"
          > > month$="09"
          > > day$="02"
          > > year$="2010"
          > > dollars$="123"
          > > cents$="45"
          > > memo$="looped 3 times but only 1 entry"
          > >
          > > ' And the resulting fields are PUT to the file with the designated
          > > ' recID.
          > >
          > > put #checks,1
          > > close #checks
          > >
          > > next x
          > >
          > > 'Code ends
          > >
          > > John "Psycho" Siejkowski
          > >
          > > end
          > >
          > >
          > >
          > >
          > >
          > > [Non-text portions of this message have been removed]
          > >
          >
        • Ingemar Bjerle
          As I see it you are doing everything right When you define a new raf-file and open it the first time and create records the first portion of your program
          Message 4 of 12 , Sep 3, 2010
            As I see it you are doing everything right
            When you define a new raf-file and open it the first time and create records the first portion of your program performs adding and puts the txt-file on the hard-drive. From now on your raf-file has 3 records. At the second run everything the program is doing is updating. If you want to add one more record you use your lof-algoritm that will give 3 .. and 3+1 will be the place for your new addition. To see the difference between adding and uppdating is an important knowledge for the understanding of the raf-file.
            From now on I am sure you can handle a raf-file and will understand what is going on.
            regards
            Ingemar

            ----- Original Message -----
            From: gpop_520
            To: libertybasic@yahoogroups.com
            Sent: Saturday, September 04, 2010 1:15 AM
            Subject: [libertybasic] Re: ten thousand questions about LB



            As I said to the others, I must be doing something wrong. I'll go back and play with. Thank you for taking the time.
            John

            --- In libertybasic@yahoogroups.com, "John" <john_siejkowski@...> wrote:
            >
            > I was trying to address your comment that using the "PUT" statement does not overwrite the existing record but "inserts" it and bumps all the other records up. I use a lot of RAF files and have never seen it do that. The example I have below puts 3 words into the datafile, then goes back and puts a new word in place of record #2. This action does not cause the exisiting words to "bump up" but simply overwrites the word "Two" as expected. Do you get the same result as me? I've not been able to duplicate what you've described and I've actually had to write code to intentionally perform that same action when I needed it.
            >
            > 'Code starts
            > 'watch for line wraps
            >
            >
            >
            > numbers$="One Two Three"
            >
            > open "RAFile.txt" for random as #checks len=20
            > field #checks,_
            > 20 as name$,_
            >
            > for recID = 1 to 3
            > namword$(numberse$= $,recID) 'put simple words into file
            > put #checks,recID 'as records 1,2,3
            > NumRecords=lof(#checks)/20
            > print NumRecords
            > next recID
            >
            > name$="Four"
            > put #checks, 2 'update second record to word "Four"
            > NumRecords=lof(#checks)/20
            > print NumRecords
            > close #checks
            > end
            >
            > 'Code ends
            >
            > John "Psycho" Siejkowski
            >
            > --- In libertybasic@yahoogroups.com, "Ingemar Bjerle" <ingbje@> wrote:
            > >
            > >
            > > 'Every time you add a new record NumRecords increases with one.
            > >
            > > NumRecords = lof(#checks)/115 ' this line calculates the NumRecords value
            > > for rec = 1 to NumRecords
            > > gettrim #checks, rec
            > > NAMES$(rec) = name$
            > > next rec
            > >
            > > Your program is as I see only handling one single record as NumRecord stays at one all the time.
            > > You say you are inserting (I call that "update" and the NumRecords does not change) and when I increase NumRecords I call that "add"
            > > When update is performed NumRecords stays constant.
            > >
            > > In programs with a RAF-file I always have an add-button and a update button
            > >
            > > [add]
            > > recNum = lof(#checks) /115 + 1 ' calc location of record to add
            > > put #checks, recNum
            > > wait
            > > [update]
            > > put #checks, recNum
            > > wait
            > >
            > > kind regards
            > > Ingemar
            > >
            > > ----- Original Message -----
            > > From: John
            > > To: libertybasic@yahoogroups.com
            > > Sent: Friday, September 03, 2010 12:34 AM
            > > Subject: [libertybasic] Re: ten thousand questions about LB
            > >
            > >
            > >
            > >
            > >
            > > --- In libertybasic@yahoogroups.com, "gpop_520" <gpop_520@> wrote:
            > > >
            > > >
            > > >
            > > > --- In libertybasic@yahoogroups.com, "Stefan Pendl" <pendl2megabit@> wrote:
            > > > >
            > > > > > >
            > > > > > > PUT does overwrite the record as to my observations, I have
            > > > > > never had a RAF act differently.
            > > > > > >
            > > > > >
            > > > > > ' data is selected via a combobox and the record number is read
            > > > > >
            > > > > > #chkwin.list "selectionindex? recID"
            > > > > >
            > > > >
            > > > > ---snip
            > > > >
            > > > > >
            > > > > > ' And the resulting fields are PUT to the file with the designated
            > > > > > ' recID.
            > > > > >
            > > > > > put #checks,recID
            > > > > >
            > > > > > ' The added record does not overwrite the existing record but is
            > > > > > ' inserted.
            > > > > >
            > > > >
            > > > > Do you fill the combo box array starting as index zero, if so, your returned index is wrong, since it is one-based.
            > > > >
            > > > > You are encouraged to not use the zero index with combo and list boxes, which is mentioned in the help file.
            > > > >
            > > > > ---
            > > > > Stefan Pendl
            > > > > http://stefanpendl.runbasichosting.com/
            > > > >
            > > > No, the NAME$ array used below to populate the combobox is populated starting with index 1:
            > > >
            > > > combobox #chkwin.list, NAMES$(), [selectionmade], boxx, boxy - 25, 300, 20
            > > >
            > > > for rec = 1 to NumRecords
            > > > gettrim #checks, rec
            > > > NAMES$(rec) = name$
            > > > next rec
            > > >
            > >
            > > Does this alteration of your code result in only 1 entry?
            > > I used static data but "PUT" it into the datafile 3 times and I only show 1 entry indicating the original was replaced rather than being inserted and older ones pushed up.
            > >
            > > 'Code Start
            > >
            > > for x = 1 to 3
            > >
            > > open "C:\Liberty BASIC v4.04\file.txt" for random as #checks len=115
            > > field #checks,_
            > > 60 as name$,_
            > > 2 As month$,_
            > > 2 as day$,_
            > > 4 as year$,_
            > > 5 as dollars$,_
            > > 2 as cents$,_
            > > 40 as memo$
            > >
            > > ' data is selected via a combobox and the record number is read
            > >
            > > ' data is retrieved from one combo box and several text boxes
            > > ' if a change was made
            > > name$= "name field"
            > > month$="09"
            > > day$="02"
            > > year$="2010"
            > > dollars$="123"
            > > cents$="45"
            > > memo$="looped 3 times but only 1 entry"
            > >
            > > ' And the resulting fields are PUT to the file with the designated
            > > ' recID.
            > >
            > > put #checks,1
            > > close #checks
            > >
            > > next x
            > >
            > > 'Code ends
            > >
            > > John "Psycho" Siejkowski
            > >
            > > end
            > >
            > >
            > >
            > >
            > >
            > > [Non-text portions of this message have been removed]
            > >
            >





            [Non-text portions of this message have been removed]
          Your message has been successfully submitted and would be delivered to recipients shortly.