Knowledge Base

How to Display Grid-Based Logical Fields as Other than T or F

Article ID: 133738

Article Last Modified on 2/15/2000


APPLIES TO


This article was previously published under Q133738

SUMMARY

This article gives you two methods you can use in Visual FoxPro to display logical fields with values other than true (T) or false (F) in a grid. For example, you might want to display values such as yes (Y) or no (N).

NOTE: In FoxPro version 2.x, this display was created using a BROWSE picture clause. For more information, please see the following article in the Microsoft Knowledge Base:

99908 Making Logicals Show "Y" or "N" in a Browse or Screen

MORE INFORMATION

Preparations for Both Methods

Use the following steps to set up Column1 of the grid to display the existing logical field for reference.

  1. Create a form, and use the VFP\Samples\Data\Products table as the data environment.
  2. Drag the table onto the form to create a grid.
  3. Set the grid layout ColumnCount property to 2.
  4. Set the Column1 ControlSource property to products.discontinu.
Use one of the following two methods to display the logical field with a different value.

Method One

  1. Set the Column2 ColumnSparse property to false (.F.).
  2. Set the Column2 ControlSource property to products.discontinu.
  3. Set the Column2 Text1 InputMask property to Y.
  4. Run the Form. Column1 shows the actual table values, and Column2 shows the equivalent Y or N.
Notes:

Method Two

  1. Set the Column2 ControlSource property to:
       IIF(products.discontinu, "Yes", "No ")  && The space after No is an
                                               && attempt to give the
                                               && strings the same length.
    						
  2. Run the Form. Column1 shows the actual table values, and Column2 shows the equivalent Yes or No value.
Notes:


Additional query words: VFoxWin

Keywords: KB133738