Letting users redefine the crosstab

NoteAvailability This technique is available in PowerBuilder and the Web ActiveX.

With the CrosstabDialog method, you can allow users to redefine which columns in the retrieved data are associated with the crosstab’s columns, rows, and values during execution.

The CrossTabDialog method displays the Crosstab Definition dialog box for the user to define the data for the crosstab's columns, rows, and values (using the same techniques you use in the DataWindow painter). When the user clicks OK in the dialog box, the DataWindow control rebuilds the crosstab with the new specifications.

Displaying informational messages

You can display informational messages when a crosstab is rebuilt during execution as a result of the call to CrosstabDialog. (The messages are the same ones you see when building a crosstab in the DataWindow painter, such as Retrieving data and Building crosstab.) You might want to do this if you are working with a very large number of rows and rebuilding the crosstab could take a long time.

PowerBuilder In PowerBuilder, you use a user event to display the crosstab’s informational messages.

StepsTo display informational messages when a crosstab is rebuilt:

  1. Define a user event for the DataWindow control containing the crosstab. Associate it with the event ID pbm_dwnmessagetext.

  2. In the script for the user event, get the value of the text argument (which holds the message that PowerBuilder would display when building the crosstab in the DataWindow painter) and display it to the user.

Web ActiveX In a Web page, you use the DataWindow’s onMessageText event to handle informational messages.

StepsTo display informational messages when a crosstab is rebuilt:

  1. Edit the code for the onMessageText event of your DataWindow control.

  2. In that event, get the value of the Text argument and display it to the user.

Examples

PowerBuilder In the example, code for the DataWindow control’s user event for pbm_dwnmessagetext displays informational messages in a static text control in the window containing the crosstab:

st_message.Text = text

With that script in place, after CrosstabDialog has been called and the user has redefined the crosstab, as the crosstab is being rebuilt, your application dynamically displays the informational messages in the static text control st_message. (You might want to reset st_message.Text to be the empty string in the line following the CrosstabDialog call.)

In this example, code in the user event for pbm_dwnmessagetext displays informational messages as MicroHelp in an MDI application (w_crosstab is an MDI frame window):

w_crosstab.SetMicroHelp(text)

The informational messages are displayed in the MDI application's MicroHelp as the crosstab is rebuilt.

For more information

For more about user events in PowerBuilder, see the PowerBuilder Users Guide.

For more about the CrosstabDialog method and MessageText event, see the DataWindow Reference.