Recent

Author Topic: (SOLVED) - Check database field value with if statement.  (Read 1085 times)

jptferreira

  • New Member
  • *
  • Posts: 18
(SOLVED) - Check database field value with if statement.
« on: May 21, 2019, 07:45:05 pm »
I'd like recommendation for the best way to get a value from a selected database field and check if it is True or False to then act upon the result.
example:
if databasefield = 'True' then show menu item
Using pascal I don't know how to check if the selected database field has the content True or False.

The IF statement is required but I'm having a hard time finding the best solution.
Any help!  :D
« Last Edit: May 21, 2019, 10:02:09 pm by jptferreira »

valdir.marcos

  • Hero Member
  • *****
  • Posts: 1106
Re: Check database field value with if statement.
« Reply #1 on: May 21, 2019, 09:16:41 pm »
I'd like recommendation for the best way to get a value from a selected database field and check if it is True or False to then act upon the result.
example:
if databasefield = 'True' then show menu item
Using pascal I don't know how to check if the selected database field has the content True or False.
The IF statement is required but I'm having a hard time finding the best solution.
Any help!  :D
One possibility:
Code: Pascal  [Select][+][-]
  1.   if (SQLQuery1.FieldByName('LogicalField').AsBoolean) then
  2.   begin
  3.     // true...
  4.   end
  5.   else
  6.   begin
  7.     // false...
  8.   end;
  9.  

jptferreira

  • New Member
  • *
  • Posts: 18
Re: Check database field value with if statement.
« Reply #2 on: May 21, 2019, 10:01:26 pm »
Thank you! :D

 

TinyPortal © 2005-2018