Jump to content

<solved> Trying to display columns from Array in GUI

Recommended Posts

  • Moderators

I have a script that creates and manages a small scheduling SQLite database for cancer patients at one of my customers. I was thinking of wrapping a GUI around it, to make it a bit more user friendly. For now the interface is very minimalist (first screenshot). I would like to display the first and last name, culled from the appropriate columns, in the box on the left (second screenshot). The SQLite query is no problem; I'm just wondering as to a method of pulling this data into a form. The relevant portion of the SQLite code is below; any suggestions would be appreciated.

#include <SQLite.au3>
#include <SQLite.dll.au3>
#include <File.au3>
#include <Array.au3>
Local $aResult, $iRows, $iColumns, $iRval


If Not FileExists(@DesktopDir & "\abc.db") Then

$hDb = _SQLite_Open(@DesktopDir & '\abc.db')

Func _create()

$hDb = _SQLite_Open(@DesktopDir & '\abc.db')
  _SQLite_Exec(-1, "Create table Patients(ID, First_Name, Last_Name, Phone_Number, Next_Appointment)")


Func _addUser()

  $pID = InputBox("Patient Care Database", "Please enter a unique ID for the Patient")
  $fName = InputBox("Patient Care Database", "Please enter the Patient's First Name")
  $lName = InputBox("Patient Care Database", "Please enter the Patient's Last Name")
  $phoneNum = InputBox("Patient Care Database", "Please enter the Patient's Contact Number")
  $nextAppt = InputBox("Patient Care Database", "Please enter the date of the Patient's Next Appointment")

  _SQLite_Exec(-1, 'INSERT INTO Patients VALUES (' & _
     '"' & $pID & '", "' & $fName & '", "' & $lName & '", "' & $phoneNum & '", "' & $nextAppt & '")' )

  $msg = MsgBox(4, "Patient Care Database", "Would you like to add another Patient?")
     If $msg = 6 Then


Func _query()

  Local $hQuery, $aRow, $sMsg

  $query = InputBox("Patient Care Database", "Please enter the Patient's ID or Last Name")

  Local $aQuery = _SQLite_Query(-1, "SELECT Next_Appointment FROM Patients WHERE ID='" & $query & "' OR Last_Name='" & $query & "'", $hQuery)

   While _SQLite_FetchData($hQuery, $aRow) = $SQLITE_OK
    $sMsg &= $aRow[0]

  MsgBox(0, "Patient Care Database", $sMsg)


$iRval = _SQLite_GetTable2d(-1, "Select Last_Name, First_Name from Patients;", $aResult, $iRows, $iColumns)

If $iRval = $SQLITE_OK Then
  _ArrayDisplay($aResult, "Patient Care Database", -1)


Edit: Disregard my laziness, should have read deeper into the help file. It seems I can use GUICtrlListView to do something like this.

Edited by JLogan3o13

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    No registered users viewing this page.

  • Create New...