Custom select dialogs

You can create your own custom Select dialog to replace the standard Create Select Statement dialog that opens when clicking Select. In the QvFacebookConnector example, a custom Select dialog has been implemented and the button showing in the Script Editor has been labeled Metadata.

Do the following:

  1. In your class extending QvxServer, override the method public override string CustomCaption to activate your custom button and set its name.
  2. In the same class, override the method public override string CreateSelectStatement(). The only requirement is that this method returns a script (for example, “SQL SELECT * FROM friends;”). In the QvFacebookConnector example, a dialog is launched. In the dialog, table selections can be made and then the dialog returns a script that is, in turn, returned to QlikView.

    Running QvFacebookConnector in QlikView 11

The following code example is taken from the file QvFacebookServer.cs in the QvFacebookConnector example:

/// <summary> /// Set the label for the custom button in QlikView. /// </summary> public override string CustomCaption { get { return "Metadata..."; } } /// <summary> /// Create the select statement. /// </summary> /// <returns>The select statement.</returns> public override string CreateSelectStatement() { var metadataWindow = CreateSelectWindowHelper(); metadataWindow.ShowDialog(); string statement = null; if (metadataWindow.DialogResult.Equals(true)) { statement = metadataWindow.Statement; } return statement; } private QvSelectMetadataDialog CreateSelectWindowHelper() { // Since the owner of the metadataWindow is a Win32 process we need to // use WindowInteropHelper to make it modal to its owner. var metadataWindow = new QvSelectMetadataDialog(); var wih = new WindowInteropHelper(metadataWindow); wih.Owner = MParentWindow; return metadataWindow; }

Did this information help you?

Thanks for letting us know. Is there anything you'd like to tell us about this topic?

Can you tell us why it did not help you and how we can improve it?