Re: start with sqlite
Posted: Wed May 15, 2019 4:53 pm
Hello, Dragan friend
Congratulations for the contribution
I understood, that there were problems with the field "L" -> Boolean
But I modified the Boolean field theme a bit, which in our case would be "MARRIED"
Look at Change in the Grid the following Code
and in FUNCTION LoadData_4687 (_sql), the following
I've only reviewed this part of the sample
It seems that now it is seen in Grid '.T.' or '.F.' instead of ' 0' or '1'
regards
Mustafa
Congratulations for the contribution
I understood, that there were problems with the field "L" -> Boolean
I have not been able to look at all the contents of the Sample CUST.prgNote: for now it does not work with boolean / logical fields[
But I modified the Boolean field theme a bit, which in our case would be "MARRIED"
Look at Change in the Grid the following Code
Code: Select all
@ 90.10 GRID Grid_9;
WIDTH 950;
HEIGHT 400;
HEADERS {"CUSTNUM", "FIRSTNAME", "LASTNAME", "ADDRESS", "CITY", "STATE", "MARRIED", "PHONE", "FAX"};
WIDTHS {100,100,100,250,150,30,70,130,130};
VALUE 1;
ON CHANGE ViewRecord_4687 ();
ON DBLCLICK EditRecord_4687 ("");
ON HEADCLICK {{|| head1_4687 ()}, {|| head2_4687 ()}};
JUSTIFY {1,0,0,0,0,0,2,0,0}
Code: Select all
*:---------------------------------------------*
FUNCTION LoadData_4687( _sql )
Local i:=0
PRIVATE cValue_1
DELETE ITEM ALL FROM Grid_9 of Win_9
If !empty( _sql )
aTable := sql( dbo, _sql )
Win_9.dSelect.Value := _sql
Else
_sql := " SELECT t1.custnum, t1.firstname, t1.lastname, t1.address, t1.city, t1.state, t1.MARRIED, t1.phone, t1.fax "
_sql += " FROM CUSTOMER t1 "
if !empty(custom_query)
_sql += " AND " + custom_query
endif
aTable := sql( dbo, _sql )
Endif
For i := 1 to len(aTable)
aCurRow := aTable[i]
cValue_1 := aCurRow[7]
IF cValue_1 = '1'
cValue_1 := '.T.'
ELSE
cValue_1 := '.F.'
ENDIF
ADD ITEM { Str(aCurRow[1],10), aCurRow[2], aCurRow[3], aCurRow[4], aCurRow[5], aCurRow[6], cValue_1 , aCurRow[8], aCurRow[9] } TO Grid_9 Of Win_9
if i > 300
msginfo( "300+ rows" )
exit
endif
Next
Win_9.StatusBar.Item(1) := "Selected " + alltrim(str( len(aTable) )) + " records "
Win_9.StatusBar.Item(2) := " "
StatusRec := "X"
Win_9.Grid_9.SetFocus
RETURN Nil
It seems that now it is seen in Grid '.T.' or '.F.' instead of ' 0' or '1'
regards
Mustafa