How to invoke the GroupDll Component to display a filterable and groupable query

<< Click to Display Table of Contents >>

Navigation:  Programming Mechworks PDM > DBWCommandShell > Object Reference >

How to invoke the GroupDll Component to display a filterable and groupable query

MechWorks MWScriptGUI Scripting Utility Object

The GroupDll component is used in the scripts to display data in a groupable fashion. The component is invoked from a script indirectly through an executable that receives the parameters in the command line. The parameters that can be passed are 3:

a.The standard query

b.A query adapted for filtering based upon a string value (to be entered in real time by the user)

c.The title of the dialog

The standard Query

This is the default query that is displayed when the dialog is displayed

The query containing a filtering value

This is the query that is displayed when the user enters a string value in the filter box on the top right of the dialog. This query is the standard one with an added condition of type LIKE '%filtervalue%' where filtervaluewill be replaced at run time with the value typed by the user. We recommend assigning a value of type string. Should you apply the condition to a numeric fields, be aware that there is no validation of the content of the textbox and if the resulting query is incorrect it will not be applied and the results will not update. If the user clears the filtering box, the query displayed is the standard one, with no additional condition.

The title of the dialog

This is displayed on top of the dialog

Example

Let's see an example of script that can be adapted to display a filterable query:

'.ASYNCH
Dim swApp
Sub main()
set dbwpar = CreateObject("mwscriptgui.dbwpar")
 elt = dbwpar.lookup("NAME_EVENT_LOG_TABLE")
 eltd = dbwpar.lookup("NAME_FIELD_EVENT_LOG_EVENTDATE")
 eltt = dbwpar.lookup("NAME_FIELD_EVENT_LOG_EVENTTIME")
 eltdoc = dbwpar.lookup("NAME_FIELD_EVENT_LOG_DOCUMENT")
set dbwpar = nothing
query= "SELECT * FROM " + elt + " ORDER BY " + eltd + " DESC, " + eltt + " DESC"
queryForFilter= "SELECT * FROM " + elt + " WHERE " + eltdoc + " LIKE '%filtervalue%' ORDER BY " + eltd + " DESC, " + eltt + " DESC"
title= "Events Log"
exePath = DBWGetInstallationPath() & "\vsgroup.exe"
cmd = """" & exePath & """ """ & query & """ """ & queryForFilter & """ """ & title & """ "
Set wshShell = CreateObject ("WSCript.shell")
wshshell.run cmd, 1, True
set wshshell = nothing
end sub

If you want to adapt the script to run for a custom query, you should assign the 3 variables:

Query:to contain your standard query

QueryForFilter:to contain a query with an added condition where the string filtervaluewill be replaced at run time with the value typed by the user

Title:with the title to be displayed in the dialog

The rest of the script can be left as is. If you intend to distribute the script to companies using distinct languages, you will need to obtain the localized names of the fields, as it is done in the first few lines of this script.