[SOLVED] How to get the value of a Boolean field lazarus / 16-Databases ---------------------------------------------------------------------- Hopestation · 2016-01-24 19:12 Hi. I was using a character field to hold boolean data, (Ticked,C,1) in a .dbf database. I used: if dbf.fields[N].text = 'Y' to find the records I wanted. Now I've changed the field to Boolean, (Ticked,L) and changed the "Ys" to TRUE. I can't find out how to do the same search. I've set the Field definition to ftBoolean and I get a column of tick boxes in the DBFGrid, with ticks where the "Ys" used to be. As this is no longer a text field I omitted ".text" from the if statement. Compiling   if dbf.fields[N] gives the error:     unit1.pas(56,19) Error: Boolean expression expected, but got "TField". Compiling    if dbf.fields[N] = true; gives the same error. What is the correct way to do this? Also, what is the correct way to set and reset the logical status? Thanks. ---------------------------------------------------------------------- FTurtle · 2016-01-24 19:42 Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i if dbf.fields[N].AsBoolean then ---------------------------------------------------------------------- Hopestation · 2016-01-24 22:38 Thanks for your help. It has solved the problem of the IF statement. Based on that I used:     dbf.Fields[N].AsBoolean := true; to change the record from False to True but nothing happened. I can toggle the state of the boolean field on the DBGrid by repeated clicking on it, but the run-time code is ignored. I have obviously missed something here but I can't see what it is. ---------------------------------------------------------------------- FTurtle · 2016-01-25 06:37 Quote from: Hopestation on January 24, 2016, 11:38:10 pmBased on that I used:     dbf.Fields[N].AsBoolean := true; to change the record from False to True but nothing happened. You may have forgotten about Edit/Post: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i   dbf.Edit;  dbf.Fields[N].AsBoolean :=   // editing of other fields  dbf.Post; ---------------------------------------------------------------------- Hopestation · 2016-01-25 11:02 Thanks again. It is a while since I worked with a DBF and I had overlooked this.