Announcement

Collapse
No announcement yet.

Help with Grid Object and SQLite3

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Help with Grid Object and SQLite3

    Good afternoon friends.

    I have a hard time on a project I am developing and I hope I can count on your help.
    I created a Grid Object (following image) with the first row and first column fixed with the header (columns) and specific values (rows). I want to search a Sqlite3 database for a particular item using three variables as filters and according to the result, specify a cell in the grid to have that value.
    I am using the version of SqLite3 in the following image and the following command, also below, but the result is not displayed in the specified cell (is blank)
    Can someone help me?
    Thanks in advance for the attention of friends.

    Grid.Refresh("Grid_Agenda")

    function FilterAgenda()
    sVar1 = Input.GetText("Input_Profissional");
    sVar2 = Input.GetText("Input_Data");
    sVar3 = Grid.GetCellText("Grid_Agenda", 1, 0);
    for row in db:nrows ("SELECT * FROM Agendamento WHERE DiaAgendado LIKE '%"..sVar2.."%' and Profissional LIKE '%"..sVar1.."%' and HoraAgendada LIKE '%"..sVar3.."%'") do
    local NewRow = Grid.InsertRow("Grid_Agenda", -1, false)
    Grid.SetCellText("Grid_Agenda", 1, 1, row.Nome, false);
    end

    end

    -- Refresh the grid
    Grid.Refresh("Grid_Agenda")


    Click image for larger version

Name:	plugin sqlite3.png
Views:	232
Size:	12.2 KB
ID:	304230 Click image for larger version

Name:	Grid Object.png
Views:	72
Size:	8.2 KB
ID:	304231

  • #2
    Bret, shouldn´t you be pointing to the insterted row?

    Instead of:

    for row in db:nrows ("SELECT * FROM Agendamento WHERE DiaAgendado LIKE '%"..sVar2.."%' and Profissional LIKE '%"..sVar1.."%' and HoraAgendada LIKE '%"..sVar3.."%'") do
    local NewRow = Grid.InsertRow("Grid_Agenda", -1, false)
    Grid.SetCellText("Grid_Agenda", 1, 1, row.Nome, false);
    end

    I believe should be:

    for row in db:nrows ("SELECT * FROM Agendamento WHERE DiaAgendado LIKE '%"..sVar2.."%' and Profissional LIKE '%"..sVar1.."%' and HoraAgendada LIKE '%"..sVar3.."%'") do
    local NewRow = Grid.InsertRow("Grid_Agenda", -1, false)
    Grid.SetCellText("Grid_Agenda", NewRow, 1, row.Nome, false);
    end

    David R.

    Comment


    • #3
      David,

      I also tried that. Did not work.
      I still can't figure out where I'm going wrong.

      Comment


      • #4
        Sorted out.

        My mistake was to be putting the filter function in the wrong place.
        Thank you for your help.



        Comment

        Working...
        X