QBE Column Selector

QBE blocks can be set up to allow the user to select the columns that will be displayed on the list block when a query is performed.  The column selector is a field object that can be added to a QBE block.  This feature works very well with QBE/List combination blocks.

The following rules apply for the list block:

  1. The header block must have a Z order of 1.  The header block is the block that contains the labels.

  2. The database block must have a Z order of 2.  The database block is the block that is mapped to a database table or view/

  3. All non database fields in the database block will always be output.  You will want to have one of these set up as the link to the screen in edit mode, if applicable.

  4. There must be exactly one label in the header block for each field in the database block.  They will need to have the same Z order, but they can be hidden (visible property set to false) if you do not want them to be visible on the list block.

  5. The database block must not wrap, i.e. all of the fields in the database block must have the same Y value.

  6. The database block must not repeat horizontally.

  7. The spacing between the labels and fields is calculated as:

How the Column Selector Works

 

This image is an example of the column selector object.

The left side of the column selector lists the names of the fields that are available to be selected for display on the list block.  If the list block fields have been assigned tool tips, the tool tip text will be displayed instead of the column name.

The right side lists the names for the fields that have been selected for display on the list block.

Fields marked as visible on the list block are displayed on the right side (selected) automatically.  Fields marked as invisible on the list block are displayed on the left side (available) automatically.

Fields will the Suppress on CSO property set to true will not be included in the column selector and will be hidden or displayed on the list block in accordance with their property settings.

You can order the fields using the up and down arrows on the far right.

When all fields have been selected and ordered, press the button or link the executes the search on the QBE block.  The list screen is displayed with only the selected fields in the selected order.  Fields that were not selected and their labels will not be displayed on the list screen.

Creating the QBE Column Selector

  1. In the Explorer Tree, locate the object to which you wish to add the column selector.  

  1. Add a Label to the QBE block.

  2. Save the block.

  3. Expand the block and select the newly added label.  Display the property sheet for the label.

  4. In the Display As property, select QBE Column Selector.

  5. In the Field Style pop-list, select the style to be used for the column selector on this screen. If set to (from parent), the default field style for the block will be used.

  6. In the X property, enter the location in pixels of the top left corner of the column selector on the X-axis (horizontal) of the layout screen.  You can change this here, or it will be changed when you move the column selector with the Designer Tool.

  7. In the Y property, enter the location in pixels of the top left corner of the column selector on the Y-axis (vertical) of the layout screen.  This value is used in conjunction with the Y Anchor Type setting.  You can change this number manually, or it will be changed when you are altering the layout with the Designer Tool.

  8. In the Y Anchor Type pop-list, select the container for the column selector .  Choices are Fixed and Relative to Field.

    When set to Fixed, the upper left corner of this field will be placed a fixed number of pixels in relation to the upper left corner of the field's parent.  The number of pixels is defined in the Y field for the block.

    When set to Relative to Field, the upper left corner of this field will be placed a fixed number of pixels from the bottom edge of the specified field defined in the Y Anchor field.

  9. In the Y Anchor property, select the field that will be used to determine the location of the field on the Y-axis.  The property is only displayed when the Y Anchor Type pop-list is set to Relative to Field.

  10. In the Width property, enter the width of the field in pixels.

  11. In the Height property, enter the height of the field in pixels.

  12. The Expand Type pop-list is set to Fixed No Scroll Bars and cannot be changed.  The column selector will be the exact size defined using the Width and Height values.

  13. In the Z Order property, enter the order in which the column selector will be displayed in comparison with the other fields on the block.  

    At this time, Z order only affects fields when they overlap one another.  For example, if you had 2 fields of the same size in the same location on the block, one with a Z order of 1, and the other with a Z order of 2, the one with the Z order of 2 will be displayed because it was generated last.

  14. The Created on property displays the date and time on which the column selector was created and cannot be changed.

  15. The Modified on property displays the date and time on which the column selector was last changed, and cannot be modified.

  16. Press the [Save] button to save the changes.

  17. Right click on the screen entity and select Designer Frame to display the Designer Tool.

  18. The column selector fields starts out the same size as any other field, but it needs to be larger to accommodate the functionality.  In the Designer Tool, enlarge the field containing the column selector until you can see all of the buttons and the entire length of the field names when you run the block.

  19. Some changes are also needed for the list block.

  20. If your screen has an edit mode, make sure you add a label and create a hyperlink that links to the screen in edit mode.  

    The default for list mode during block creation  is that the first column on the list is assigned the link to the screen in edit mode, passing the primary keys.  For screens using the column selector, this will not work because the user may not select that field.

  21. In the Designer Tool, display the screen in List Mode.

  22. For each field in the database block, in the Tool Tip property, enter the text that you want to be displayed for that field in the column selector.  For example, you might want the text to read Item Number instead of the field name of ITEM_NO.  If there is a tool tip entered for the field, that text will be displayed instead.

  23. For all fields that you want selected automatically (placed on the right side of the selector), verify that the Visible property for both the label and the field is set to true.

  24. For all fields that you want available, but not selected (placed on the left side of the selector), set the Visible property for both the label and the field to false.

  25. For all fields that you want included in the list block, but not available to be selected or selected automatically, set the Suppress on CSO property to true.  When this flag is set to true, the field will not be included in the column selector, and will be displayed or hidden on the list block according to the field properties.

  26. Line up the fields and labels on the list in the order of the Z orders assigned to them.  The one with the lowest Z order should go on the far left.  The one with the next lowest Z order should be placed to the right of that with the desired space between them  The space between the end of the first field and the beginning of the second field is what determines the default space between all of the fields.  

    If you have an edit screen, the link label field for navigating to that field should be placed first.  That way it will always be displayed in the same place.

  27. Stack all of the remaining database fields on top of the second field.  When the list screen is generated, it will determine where the fields will be placed and in what order.

  28. Press the [Save] button to save the changes.