Dialogs
The OctoSAM Inventory query engine supports a variety of input controls to pass input to a query.
<dialog>
<input name="package"
type="dropdownlist"
title="Package">
<select>
<![CDATA[ SELECT Name , ID FROM SoftwarePackage WHERE MeteringEnabled = 1 ORDER BY [Name] ASC
]]>
</select>
</input>
<input name="timespan"
type="timespan"
timespan="all"
title="Usage within"
minmaxdatesql="SELECT MIN(UsageDate), MAX(UsageDate) FROM UsageDetail"
conditioncolumn="ud.UsageDate"
conditionprefix="AND"
conditionsuffix=""
errormessage="No suitable usage data in the database" />
<input type="checkbox" name="unused" title="Include unused installations" />
</dialog>
The input controls fill their values to properties named ${prefix_name} where prefix can be specified as an attribute of the dialog element “dialog” is the default.
Dialog Element
Attribute | Required | Default Value | Description |
---|---|---|---|
prefix | N | 'dialog' | Prefix to use to name properties |
optional | N | false |
The input dialog is optional, query should start with default values and allow optional changes afterwards. At the moment this is implemented for web only |
Input Controls
Common Attributes
Attribute | Required | Default Value | Description |
---|---|---|---|
name | Y | Name of the input control | |
title | Y | Label text to display | |
type | Y | Type of the input control |
Control checkbox
Attribute | Required | Default Value | Description |
---|---|---|---|
tooltip | N | Specify text of a tooltip that is shown when the mouse hovers over the control | |
value | N | true or false |
Initial value |
Control date
Allows to input a date using a calendar control. Note that the initial value of this control is always set to “today”.
Attribute | Required | Default Value | Description |
---|---|---|---|
format | N | .net date format |
Control dropdownlist
Select exactly one item from a given list. You can specify the list using
<input name="freespace"
type="dropdownlist"
title="Free Space Less than">
<option title="10 GB" value="10000000000" />
<option title="5 GB" value="5000000000"/>
<option title="2 GB" value="2000000000"/>
<option title="1 GB" value="1000000000"/>
<option title="500 MB" value="500000000"/>
</input>
<input name="package"
type="dropdownlist"
title="Package">
<select>
<![CDATA[ SELECT Name , ID FROM SoftwarePackage WHERE MeteringEnabled = 1 ORDER BY [Name] ASC
]]>
</select>
</input>
Control label
Displays its text attribute in the current position of the input section. Does not collect input.
Attribute | Required | Default Value | Description |
---|---|---|---|
align | N | left | align left or right |
Control multiselection
Used to select one or more items from a given list.
Attribute | Required | Default Value | Description |
---|---|---|---|
limit | N | max number of items that can be selected | |
stockquery | N | used to load the most commonly used queries predefined in the query engine |
<input name="organizations"
type="multiselection"
title="Organizations">
<select select-if="${?sub_select_organizations_count}=users">
<![CDATA[
/* display count of users behind organization name */
SELECT o.NAME +' (' + CAST(COUNT(u.ID) AS VARCHAR) +')', o.ID FROM Organization o INNER JOIN [User] u ON o.ID = u.OrganizationID GROUP BY o.Name,o.ID ORDER BY o.Name,o.ID
]]>
</select>
<select>
<![CDATA[
/* display count of machines behind organization name */
SELECT o.NAME +' (' + CAST(COUNT(m.ID) AS VARCHAR) +')', o.ID FROM Organization o INNER JOIN Machine m ON o.ID = m.OrganizationID GROUP BY o.Name,o.ID ORDER BY o.Name,o.ID
]]>
</select>
</input>
The example shows how to load a multi selection control with data from the database. Note how two different select statements are defined and the select-if attribute is used to select one of the statements based on the value of ${sub_select_organizations_count}
.
Control numericupdown
Attribute | Required | Default Value | Description |
---|---|---|---|
maximum | N | 100 | maximum value |
minimum | N | 0 | minimum value |
Control text
Attribute | Required | Default Value | Description |
---|---|---|---|
easywildcards | N | false |
if true, If true, the control will change * to % and ? to _ for SQL LIKE search |
maxlength | N | max text length | |
regex | N | .* | regex to validate input |
Control timespan
<input name="timespan"
type="timespan"
timespan="all"
title="Logins/Usage within"
minmaxdatesql="SELECT MIN(muh.Scan), MAX(muh.Scan) FROM MachineUserHistory muh"
conditioncolumn="muh.Scan"
conditionprefix=""
conditionsuffix=""
errormessage="No suitable usage data in the database">
</input>
The control returns SQL code to include in the where clause of a query in the $
Attribute | Required | Default Value | Description |
---|---|---|---|
conditionprefix | Y | SQL fragment that is inserted before the condition | |
conditionsuffix | N | SQL fragment that is inserted after the condition | |
errormessage | N | message to display if the minmaxdatesql does not return a suitable timespan |
|
minmaxdatesql | N | SQL statement that returns the minimum and maximum datetime that can be selected | |
timespan | N | all | initially selected timespan |
Possible Initially Selected Timespans:
- all
- custom
- today
- last3days
- last7days
- last30days
- last90days
- currentweek
- currentmonth
- currentyear
- yesterday
- lastweek
- lastmonth
- last3months
- last6months
- lastyear
Depending on the available data it may not be possible for the query to select the initially configured timespan.
Debug attributes
Input element attribute names beginning with the string 'debug' are internal to OctoSAM. They are mostly used to singnal some hints the query unit test driver.