No announcement yet.

How do I create simple Y or N table field using a checkbox?

  • Filter
  • Time
  • Show
Clear All
new posts

  • How do I create simple Y or N table field using a checkbox?

    I have looked in the examples and also the documentation but nowhere can I find how to do what I think is a simple operation.

    I have a table with a number of varchar(1) columns where the character Y means yes and N means no. Using a mask and values format I can force the user to enter Y or N but, the use of a checkbox is a lot nicer looking.

    I have created a checkbox type field but it is not obvious how I make it insert Y when checked and N when unchecked. I had assumed that I could use the manual lookup method with a simple list but nowhere can I find good documentation on how this works.

    Can someone who has done something like this please help?

    David Goadby, North Wales
    David Goadby, North Wales.

  • #2
    The most clear way would be to use a radio button. That can have two states, yes and no. Set the lookup to manual and apply yes Y and no N.

    With a checkbox you have two states, checked and unknown. So you can apply one item in the manual lookup yes for Y. Then it will have a Y but the N could be a space. Not sure.
    Albert Drent
    aducom software netherlands
    scriptcase partner, reseller, support and (turn-key) development /


    • #3
      Ok, I tried it and that works. In other RAD's I have used the checkbox can be given two values according to the state. A single radio button will do as well.

      UPDATE: Feeling flushed with success I decided to have a closer look at my original Y/N checkbox problem and I found a solution that stores "Y" when checked and "N" when unchecked.

      This is it: In the Fields Configuration (or General Settings for the field in question) I set the default value for both Insert and Update to N. Then in the General Settings for this field I set the Lookup Settings with just one entry for Yes(Y). I also set Manual Method as before. Now, if I insert a new record I get my default N unless I check the box in which case I get Y. Also, if I update the record it will store Y if checked and N if unchecked.

      The clue was in the generated SQL If the box is unchecked then "" is stored - ie nothing. If the default value is set to N then N is stored. I originally thought the default would always store that value; it seems that it is only stored if nothing else is.

      Thanks for at least putting me on the right path.
      Last edited by dgoadby; 12-15-2015, 11:57 PM. Reason: Solved the problem.
      David Goadby, North Wales.