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.

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

checkbox Control

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

date Control

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

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>

label Control

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

multiselection Control

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 multiselection 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}.

numericupdown control

Attribute Required Default Value Description
maximum N 100 maximum value
minimum N 0 minimum value

text control

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

timespan control

<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.

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