Requests

Navigation:  Requests and Macros >

Requests

Previous pageReturn to chapter overviewNext page

Show/Hide Hidden Text

To enable you to automatically apply edits to the whole estimate or a part of it, or to an article database, QDV7 offers a request language.

It is subject to a security setting (Macros). When the permission is denied, you can still execute predefined requests in the Macros buttons group.  

On run-time, QDV7 scans each minute row and executes the code therein.

The code looks generally like

If Minutes.[<field name>] = "...." Then

...

End If

 

Request Editor

request_ribbon

Make sure an estimate is open.

Select Automation>Requests>Request editor.

The editor is a resizeable window that features several panes.

The left pane features several tabs:

the Files tab is used to identify the requests : Name, temporary name of the Estimate, Path of the file if it is external

the Conditions tab lists out the operators and reserved words for you to pick

the Verbs tab

the Fields tab lists out the natives and free fields, with their accessibility and type

the Variables tab lists out the GLV and SYS global variables of the estimate

the Scope tab shows the structural view for you to select; the selected scope is common to all shown requests

 

General Procedure

To create a new request, click New, and enter its name. To rename it, triple click the line or right click it and select Rename request.

To save the request's identity and code, click Save. Note that the scope is NOT saved. Alternative: right click the line and select Save Request>Save to estimate; in addition, you can save to file (extension: req) and reload such a filed request including the scope.

To add an external request, right click and select Import request; its path shows in the table.

To delete a request, right click its line and select Delete Request.

 

To create a chunk of code:

1.In the Files tab, double click the desired request; the symbol of the selected request shows in blue and the code shows in the right pane

2.With the other tabs, put the cursor in the right-pane desired location and double click the desired item; as a result, the item shows

3.To enter a field, tap into the tab Fields. Alternative: enter "Minutes" followed by a dot; a field picker with the mnemonics shows in line; if it does not, check the spaces  

4.Click Save; this compiles the code to store a binary image into the estimate, and tests it partially (the Proceed button square color indicates the result)  

 

NOTE The strings of characters show in brown between double quotes.

 

To execute the code:

1.In the Scope tab, select the branch/task; the selected branch or task shows below the left pane

2.Double click the desired request; its code shows

3.Click Proceed; this compiles the request

4.If it is successful and QDV7 has written to cells, the count of edited cells is posted; to see the edits, you may need to exit the editor

5.In event of error, the button square turns magenta and messages are posted. The debug pane is auto-filled; you can request to paste the native VB code into the clipboard

6.Paste the code into a text editor; in Notepad, to spot the line referenced in the Description column of the debug pane, make the Status bar visible    

 

request_editor

 

NOTE To complete the execution, you may have to close the editor.

Quick access: Automation>Requests>Execute Request. This uses the binary code.

Example of requests show in the Multi-languages sample.

 

RECOMMENDATIONS

- Remember that some operations may NOT be canceled; save the estimate beforehand

- Start comments with a simple quote; they automatically show in green

- Put space between terms

- Take care of the formats of constants

- If the yellow border runs beyond the code, delete the part that overflows

- Do not confuse these three terms:

An error pertains to the code

A warning is a message that draws your attention on read-only fields used in the code; the code can still be executed, but has no effect

An anomaly pertains to the estimate; it is the negative result of a condition put in the code and the Append_Anomaly_List verb.

 

Conditions

BOOLEAN

< is true if the first operand is higher than the second

<= is true if the first operand is higher than the second or equal

= is true if the first operand is equal to the second; the operands can be strings of chars

<> is true if the first operand is different than the second; the operands can be strings of chars

> is true if the first operand is lower than the second

>= is true if the first operand is lower than the second or equal

Contains (<String of Characters>) is true if the operand contains this string of chars

StartsWith (<String of Characters>) is true if the operand begins with this string of chars

EndsWith (<String of Characters>) is true if the operand ends with this string of chars

Is_Progress() is true if the version is a progress  

Note : Contains, StartsWith and EndsWith must be preceded by a field and potentially a domain (Minutes, ...).

 

RESERVED NAMES

They show in blue in the right pane.

If precedes an conditional expression

And is used to combine up to 4 conditions

Or is used to combine up to 4 conditions

Then; optional after If; put a line break afterwards

Else precedes a verb

ElseIf precedes another conditional expression

End If closes a condition

End closes the code

 

BASIC OPERATORS: +, -, *, /

OPERATORS FOR STRINGS

RemoveSpaces(<String of Characters>) removes leading and trailing spaces; this is recommended before executing a comparison

SubString(<String of Characters>, <Start position>, <Length>) returns a sub string from a string

Position(<String of Characters>, <String to Search>) returns the position of a string inside another

Length(<String of Characters>) returns the count of characters

UpperCase(<String of Characters>) capitalizes the whole string

LowerCase(<String of Characters>) returns the string with only lower case characters

Convert_to_Date("1/1/2014") returns the entered date and time in the format of fields AlterDate, ArticleDate, GanttEndDate, ...

& is used for concatenation  

 

By default, the request language is case-sensitive. Use the two last functions to ignore the case in a test.

EXAMPLES

'Code testing the Unit value regardless of the case, and setting the description to the plural form

If LowerCase(Minutes.[Unit]) = "u" Then

 Minutes.[Description] = Minutes.[Description] & "s" 

 End If

 

If Minutes.[AlterDate] = Convert_to_Date("30/05/2014 20:46:01"Then 

 

Verbs

Some verbs require arguments.

Append_Anomaly_List(<Message>) is used to post a list of anomalies and write this message to the Message column; the rows in the list are clickable; you can even mix statements with functions which write to the database  

Compute_All(<Force Computation>, <Synchronize with management>), usually put at the request end;

+enter arguments 1 and 0 to compute costs and prices (this replaces a click on the icon in the right lower corner: without exiting the editor, the #N/A marks disappear from the WBS and the Minutes view)

+enter arguments 0 and 1 to synchronize with a management database; refer to How to Update an Estimate

+enter arguments 1 and 1 for both actions; for details on what QDV7 does, refer to Defining Return Values

Compute_Costs_Only(): used to compute costs on request; it is far faster than Compute_All

Display_Message(<Message>, <Icon>) Icon number: see table below; a specific sound is heard

Refresh_Current_View() is used inside a loop to update the minutes right away, in particular before acknowledging the message QDV_Editor stating the count of writes

Exit_Request() is used to exit a loop for example when a first anomaly is found

Clear_Row_Values() is used to reset all values in the current row to their default value

Move_To_Column(<COLUMN ID>) moves the cursor to the specified column in the current minute row

 

Icon number

0

1

2

3

Other

Value

Information

Warning

Stop

Question

Other

Pictogram in the message

info

warning

delete

help

nil

 

METHOD

The show method can be applied to the MessageBox object; the arguments enable you to custom the window popping up on test and on execution.

Syntax: MessageBox.show("<Message to display>", "<Window Title>", MessageBoxButtons.OK, MessageBoxIcon.<Value>)

"OK" is the acknowledgment button caption.

The shown pictogram (and the heard sound) depend on the entered value as per the table above.

 

Example:

If Minutes.[Quantity] > 10 Then

 MessageBox.show(Minutes.[Description], "End of request", MessageBoxButtons.OK, MessageBoxIcon.Stop)
           Exit_Request()
End If

 

Fields

General syntax: Minutes.[<Field mnemonic>]

To read a mnemonic in the minutes view, right click the column and select Properties.

Some fields are in read-only mode either because the user profile specifies they are not editable or intrinsically as they are:

the results of computations

dates

flags, GUID, line number, line target value, etc

defined in the Overhead workbook

fields whose entry is allowed in WBS only

 

ico_tipA request that modifies the Databasesource field and includes the Compute_All verb is helpful in IDIQ contracts (Definition) Call-off contracts: contracts based on a reference estimate or an articles base imposing prices. to point to various databases after one another.

 

Variables

Access is as in the Name Manager.

All SYS variables are in read-only mode. GLV variables are in read-only mode if the cell where they are defined is locked (e.g. being a result of a selection using objects).

The editor will be replace GLV_. by [GLV_____