Search found 162 matches
- Aug 05, 2016 22:10
- Forum: Libraries Questions
- Topic: SQLite/AVG function
- Replies: 7
- Views: 2506
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...
- Aug 03, 2016 22:15
- Forum: Libraries Questions
- Topic: SQLite/AVG function
- Replies: 7
- Views: 2506
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 ...
- Jul 29, 2016 22:25
- Forum: Libraries Questions
- Topic: SQLite/AVG function
- Replies: 7
- Views: 2506
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 ' **...
- Jul 23, 2016 20:58
- Forum: Libraries Questions
- Topic: SQLite/AVG function
- Replies: 7
- Views: 2506
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...
- Jul 19, 2016 23:19
- Forum: Libraries Questions
- Topic: freeBASIC/SQLite
- Replies: 8
- Views: 5037
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...
- Apr 12, 2016 21:45
- Forum: Sources, Examples, Tips and Tricks
- Topic: SQLite3 database class (32-bit)
- Replies: 51
- Views: 13087
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...
- Apr 03, 2016 21:50
- Forum: Sources, Examples, Tips and Tricks
- Topic: SQLite3 database class (32-bit)
- Replies: 51
- Views: 13087
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
Now I have enter about 10 yrs. of data :'-(((((
Bill
- Apr 02, 2016 22:15
- Forum: Sources, Examples, Tips and Tricks
- Topic: SQLite3 database class (32-bit)
- Replies: 51
- Views: 13087
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...
- Mar 30, 2016 21:42
- Forum: Sources, Examples, Tips and Tricks
- Topic: SQLite3 database class (32-bit)
- Replies: 51
- Views: 13087
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...
- Mar 28, 2016 21:13
- Forum: Sources, Examples, Tips and Tricks
- Topic: SQLite3 database class (32-bit)
- Replies: 51
- Views: 13087
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("...
- Mar 27, 2016 21:52
- Forum: Sources, Examples, Tips and Tricks
- Topic: SQLite3 database class (32-bit)
- Replies: 51
- Views: 13087
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...
- Mar 25, 2016 22:25
- Forum: Sources, Examples, Tips and Tricks
- Topic: SQLite3 database class (32-bit)
- Replies: 51
- Views: 13087
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...
- Mar 24, 2016 22:34
- Forum: Sources, Examples, Tips and Tricks
- Topic: SQLite3 database class (32-bit)
- Replies: 51
- Views: 13087
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...
- Mar 22, 2016 22:26
- Forum: Sources, Examples, Tips and Tricks
- Topic: SQLite3 database class (32-bit)
- Replies: 51
- Views: 13087
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...
- Mar 21, 2016 19:32
- Forum: Sources, Examples, Tips and Tricks
- Topic: SQLite3 database class (32-bit)
- Replies: 51
- Views: 13087
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...