QB64 Phoenix Edition
Array in an array - Printable Version

+- QB64 Phoenix Edition (https://qb64phoenix.com/forum)
+-- Forum: QB64 Rising (https://qb64phoenix.com/forum/forumdisplay.php?fid=1)
+--- Forum: Code and Stuff (https://qb64phoenix.com/forum/forumdisplay.php?fid=3)
+---- Forum: Help Me! (https://qb64phoenix.com/forum/forumdisplay.php?fid=10)
+---- Thread: Array in an array (/showthread.php?tid=1476)

Pages: 1 2 3 4 5 6 7 8


RE: Array in an array - SpriggsySpriggs - 02-17-2023

Obligatory MySQL/SQLite suggestion.


RE: Array in an array - bplus - 02-17-2023

(02-17-2023, 05:43 PM)Balderdash Wrote: Obligatory MySQL/SQLite suggestion.

Ah yes, we still await the tut! Smile maybe Terry?


RE: Array in an array - TerryRitchie - 02-17-2023

(02-17-2023, 06:32 PM)bplus Wrote:
(02-17-2023, 05:43 PM)Balderdash Wrote: Obligatory MySQL/SQLite suggestion.

Ah yes, we still await the tut! Smile  maybe Terry?

I thought someone had already built an SQL library for QB64. Wasn't it steve? I know he built one for Dbase.


RE: Array in an array - mnrvovrfc - 02-17-2023

It would have been interesting if QB64 had to emulate more of what only BASIC v7.1 PDS offered such as ISAM. Smile

I had a great book about "advanced" programming on M$ BASIC, first focusing on QuickBASIC for windows, menu, mouse and sprite libraries, then switching to PDS to discuss ISAM. Honestly I wished I could have done something about databases back then but I have not reformed and still badly organized about certain data aspects. Had bad experiences with SQL or relative with a music instrument plug-in called Applied Acoustic Systems Tassman. Tremendous modular synthesizer, one of the earliest but had a poor preset organization system that caused the program to crash on occasion, and no hope of extensively modifying the most complex patches. Eventually the Canadian company declined making a next version 5 with VST3 64-bit support. :/


RE: Array in an array - SMcNeill - 02-17-2023

(02-17-2023, 09:12 PM)TerryRitchie Wrote:
(02-17-2023, 06:32 PM)bplus Wrote:
(02-17-2023, 05:43 PM)Balderdash Wrote: Obligatory MySQL/SQLite suggestion.

Ah yes, we still await the tut! Smile  maybe Terry?

I thought someone had already built an SQL library for QB64. Wasn't it steve? I know he built one for Dbase.

That was Spriggsy.  Smile


RE: Array in an array - TerryRitchie - 02-18-2023

(02-17-2023, 10:57 PM)mnrvovrfc Wrote: It would have been interesting if QB64 had to emulate more of what only BASIC v7.1 PDS offered such as ISAM. Smile

I had a great book about "advanced" programming on M$ BASIC, first focusing on QuickBASIC for windows, menu, mouse and sprite libraries, then switching to PDS to discuss ISAM. Honestly I wished I could have done something about databases back then but I have not reformed and still badly organized about certain data aspects. Had bad experiences with SQL or relative with a music instrument plug-in called Applied Acoustic Systems Tassman. Tremendous modular synthesizer, one of the earliest but had a poor preset organization system that caused the program to crash on occasion, and no hope of extensively modifying the most complex patches. Eventually the Canadian company declined making a next version 5 with VST3 64-bit support. :/

I relied heavily on VBDOS' ISAM tools when I was a sysadmin for a company back in the 90's. I wrote custom software to track billing, sales, inventory, purchase orders, etc.. using shared ISAM databases on the Novell server I maintained. ISAM was a great database tool because it was simple to implement and maintain.


RE: Array in an array - AtomicSlaughter - 02-18-2023

Could you not just keep all the data in comma delimited strings, and then just split them as you need them

that way there is no limit to the length of the strings and you can just add data to the end of the string giving unlimited results storage
Code: (Select All)
ReDim sData(0) as string
open "StudentData.csv" for input as #1
do
line input #1, sData(ubound(sData))
ReDim _Preserve sData(Ubound(sData)+1)
loop until eof(1)

input "Enter name or id to search for> ",s$
for i = 1 to ubound(sData)
if instr(sData(i),s$) > 0 then print sData(i)
next

Sub Str2arr (ST As String, AR() As String, DL As String)
    Dim Delim(Len(DL)) As String
    For i = 1 To Len(DL)
        Delim(i) = Mid$(DL, i, 1)
    Next
    'find first delim
    c = 1
    Do
        For i = 1 To UBound(Delim)
            If Mid$(ST, c, 1) = Delim(i) Then
                ReDim _Preserve AR(UBound(AR) + 1)
                c = c + 1
                Exit For
            End If
        Next i
        AR(UBound(AR)) = AR(UBound(AR)) + Mid$(ST, c, 1)
        c = c + 1
    Loop Until c > Len(ST)
End Sub



RE: Array in an array - bplus - 02-18-2023

(02-18-2023, 09:39 AM)AtomicSlaughter Wrote: Could you not just keep all the data in comma delimited strings, and then just split them as you need them

that way there is no limit to the length of the strings and you can just add data to the end of the string giving unlimited results storage
Code: (Select All)
ReDim sData(0) as string
open "StudentData.csv" for input as #1
do
line input #1, sData(ubound(sData))
ReDim _Preserve sData(Ubound(sData)+1)
loop until eof(1)

input "Enter name or id to search for> ",s$
for i = 1 to ubound(sData)
if instr(sData(i),s$) > 0 then print sData(i)
next

Sub Str2arr (ST As String, AR() As String, DL As String)
    Dim Delim(Len(DL)) As String
    For i = 1 To Len(DL)
        Delim(i) = Mid$(DL, i, 1)
    Next
    'find first delim
    c = 1
    Do
        For i = 1 To UBound(Delim)
            If Mid$(ST, c, 1) = Delim(i) Then
                ReDim _Preserve AR(UBound(AR) + 1)
                c = c + 1
                Exit For
            End If
        Next i
        AR(UBound(AR)) = AR(UBound(AR)) + Mid$(ST, c, 1)
        c = c + 1
    Loop Until c > Len(ST)
End Sub

Already offered the same idea in first reply: https://qb64phoenix.com/forum/showthread.php?tid=1476&pid=13567#pid13567

And here I improved the idea by dumping the delimiters and used fixed length segments into a fixed length "array" string so that the data record, UDT data, could actually be filed like a database record. https://qb64phoenix.com/forum/showthread.php?tid=1476&pid=13599#pid13599


RE: Array in an array - Kernelpanic - 02-18-2023

(02-17-2023, 05:43 PM)Balderdash Wrote: Obligatory MySQL/SQLite suggestion.

There was something about this before: Database
In the thread, Pete also explained how to create a database in Basic, and in which you can also delete records. It is more complicated than in MySQL. I wanted to try it, but could not bring myself to do it until now.
A very important point in a database is the simple deletion of data records that have become obsolete. Sorting is also important: by name and/or by personnel number, by entry date, etc.


RE: Array in an array - TempodiBasic - 02-18-2023

@NasaCow
Is this your final goal?
PowerSchool Gradebook

In what measure do you want duplicate this program?

the picture that you showed at #1 is very simple  in respect to this second program.