Search found 162 matches

by TriumphRacer
Aug 05, 2016 22:10
Forum: Libraries
Topic: SQLite/AVG function
Replies: 7
Views: 1359

Re: SQLite/AVG function

Paul, I pared down your code a bit more: SUB c_hp_avg() REM DIM AvgHP AS SINGLE REM sql = "SELECT AVG(sfMaxHP) AS AvgHP FROM baseline;" sql = "SELECT AVG(sfMaxHP) FROM baseline;" q.PrepareQuery(db,sql) q.GetRow() AV.sfAvgHP = Val(q.GetText(0)) REM ' You could also use the followi...
by TriumphRacer
Aug 03, 2016 22:15
Forum: Libraries
Topic: SQLite/AVG function
Replies: 7
Views: 1359

Re: SQLite/AVG function

Mr. Swiss, while I have no doubt your method works. it seems overly complicated to me. In view of the fact that SQL has an AVG function, I would prefer to use that. Then the problem becomes, and remains, how do I get the result of calling the AVG function over to a freeBASIC variable? I have loaded ...
by TriumphRacer
Jul 29, 2016 22:25
Forum: Libraries
Topic: SQLite/AVG function
Replies: 7
Views: 1359

Re: SQLite/AVG function

Paul, yes it works. Here is the code I ended up using. Please disregard all the REMed statements. They were used to try different approaches and for debugging. Also note the 2 screen prints inserted to show the results. ' ******************** ' this sub provides user means to compute HP average ' **...
by TriumphRacer
Jul 23, 2016 20:58
Forum: Libraries
Topic: SQLite/AVG function
Replies: 7
Views: 1359

SQLite/AVG function

I need to extract 6 AVG's from 2 SQLite tables and assign them to freeBASIC variables. Here's what I've tried so far: SUB c_hp_avg() DIM stfilename AS STRING = "example" db.OpenDatabase(stfilename) REM db.StartTransaction REM sql = "SELECT AVG(sfMaxHP) FROM baseline;" REM sfAvgHP...
by TriumphRacer
Jul 19, 2016 23:19
Forum: Libraries
Topic: freeBASIC/SQLite
Replies: 8
Views: 2769

Re: freeBASIC/SQLite

I'm back again with another freeBASIC/SQLite question. I need to extract 6 AVGs from several SQLite tables. I couldn't find any examples anywhere so I'm posting the question here. Here's what I've tried: SUB c_hp_avg() DIM stfilename AS STRING = "example" db.OpenDatabase(stfilename) REM db...
by TriumphRacer
Apr 12, 2016 21:45
Forum: Tips and Tricks
Topic: SQLite3 database class (32-bit)
Replies: 51
Views: 6313

Re: SQLite3 database class (32-bit)

Well, have to ask for help again. I've spent the last 1 1/2 wks going over this code and can't figure out what's wrong. First, I have 1 database with 4 tables. I need to populate the tables in the following order: baseline, event, current, timeslip. The first 2 work fine. Here is the code for baseli...
by TriumphRacer
Apr 03, 2016 21:50
Forum: Tips and Tricks
Topic: SQLite3 database class (32-bit)
Replies: 51
Views: 6313

Re: SQLite3 database class (32-bit)

Thanks again, Paul. It compiled fine. The name of the function, q.GetRow(), threw me off. I thought all it could do was return a row or a series of rows. Oh well, another incorrect assumption on my part.

Now I have enter about 10 yrs. of data :'-(((((

Bill
by TriumphRacer
Apr 02, 2016 22:15
Forum: Tips and Tricks
Topic: SQLite3 database class (32-bit)
Replies: 51
Views: 6313

Re: SQLite3 database class (32-bit)

Paul, this should be my last plea for help. Please look at the following code: SUB c_c_et_cf () ' compute CURRENT et correction factor DIM stSQL AS STRING DIM q AS clsSqliteQuery DIM db AS clsSqlite DIM sfET_avg AS SINGLE stSQL = "SELECT AVG ('sfTIME_1320_ft') FROM timeslip ;" q.PrepareQue...
by TriumphRacer
Mar 30, 2016 21:42
Forum: Tips and Tricks
Topic: SQLite3 database class (32-bit)
Replies: 51
Views: 6313

Re: SQLite3 database class (32-bit)

Paul, thanks again. Your explanations are worth their worth in gold. Now I also know WHY q.GetRow acts the way it does. As an aside, so far everything is working well. Now I have to run some test data through the program. At this point I'm not sure, but my history says I will need your help again. I...
by TriumphRacer
Mar 28, 2016 21:13
Forum: Tips and Tricks
Topic: SQLite3 database class (32-bit)
Replies: 51
Views: 6313

Re: SQLite3 database class (32-bit)

Thanks Paul. I rec'd your email and I'll fix my code. I did want to show you what I had tried in the meantime. q.PrepareQuery(db, sql) q.GetRow() DO WHILE q.GetRow() BL.bl_rec_no = VAL(q.GetText("bl_rec_no")) BL.stTestDate = q.GetText("stTestDate") BL.sfElev = VAL(q.GetText("...
by TriumphRacer
Mar 27, 2016 21:52
Forum: Tips and Tricks
Topic: SQLite3 database class (32-bit)
Replies: 51
Views: 6313

Re: SQLite3 database class (32-bit)

OK, yet another problem. Here is all the code for the SUB that I ended up with: SUB db_open () clrArea(4, 23, 2, 79) stInpStrg = "" stSecName = "Open an Existing SQL Database" heading (stSecName) stFileStat = "open" stFileExt = ".db" FileName () stDB = LTRIM(R...
by TriumphRacer
Mar 25, 2016 22:25
Forum: Tips and Tricks
Topic: SQLite3 database class (32-bit)
Replies: 51
Views: 6313

Re: SQLite3 database class (32-bit)

sql = "SELECT * FROM baseline WHERE bl_rec_no = " + STR(uiRecNo) + ";" q.PrepareQuery(db, sql) DO WHILE q.GetRow() BL.bl_rec_no = Val(q.GetText("bl_rec_no")) BL.stTestDate = q.GetText("stTestDate") BL.sfElev = Val(q.GetText("sfElev")) LOOP q.Finaliz...
by TriumphRacer
Mar 24, 2016 22:34
Forum: Tips and Tricks
Topic: SQLite3 database class (32-bit)
Replies: 51
Views: 6313

Re: SQLite3 database class (32-bit)

Paul, I tried to adapt your suggestion to my code. The program will not compile. Here are the things I tried and the results: sql = "SELECT * FROM baseline WHERE bl_rec_no = " + STR(uiRecNo) + ";" q.PrepareQuery(db, sql) DO WHILE q.GetRow() BL.bl_rec_no = q.GetText("bl_rec_n...
by TriumphRacer
Mar 22, 2016 22:26
Forum: Tips and Tricks
Topic: SQLite3 database class (32-bit)
Replies: 51
Views: 6313

Re: SQLite3 database class (32-bit)

Thanks again Paul. The BASELINE table will never contain very many entries. The user will pick one row when he/she opens the database. The values in that row will be used for all computations thereafter. Here is the code I have for doing that: ' ******************** ' this sub provides user means to...
by TriumphRacer
Mar 21, 2016 19:32
Forum: Tips and Tricks
Topic: SQLite3 database class (32-bit)
Replies: 51
Views: 6313

Re: SQLite3 database class (32-bit)

OK, let me respond in the same order. q.GetText requires that you pass it the table field name that you want to retrieve. It is a string Here is my table particulars: sql = "CREATE TABLE baseline (" & _ "bl_rec_no INTEGER PRIMARY KEY NOT NULL," & _ "stTestDate TEXT(1...

Go to advanced search