Document Engine Expression Editor
Overview
The Expression Editor is used to edit XSL expressions within a document. It allows the user to manipulate page elements using XSL functionality without having to resort to full-fledged coding.
Each variation of the expression editor is customized to support the specific document component.
- Common Properties:
- Expression Text Name - Each Expression must have a text name.
- Expression Description - The users can enter some description in this text area.
- Common Actions:
- Code View - View the code that is generated by the expression. The users can directly modify the code. If code is modified, the users are prompted that saving code changes will convert this expression into custom XSL.
- Update - The expression is validated and saved when this action is performed.
Variations of the Expression Editor
There are three variations of the Expression Editor:
The Loop Expression Editor is used to define and edit a loop without having to resort to any coding. Loops can be edited within a page or a document.
- Place your cursor at a point in the Page Editor where you would like to insert the repeating section.
- On the Dynamic tab, click Repeating Section.
The Expression Editor(Loop) dialog box appears.
- Enter a Name for the section.
-
Enter a Description for your repeating section.
- In the Loop Over drop-down, choose the data that is to be looped over. Line items:
- Model Line Items: Only configured line items
- Part Line Items: Only non-configured line items
- Price Book Custom Attributes: Loop through the Price Book custom attributes (fields 1-20)
- Configuration Attributes: All Configuration attributes and values
- Model Custom Attributes: All custom model attributes
- Model Product Line Custom Attributes: All product line custom attributes
- Serial Number Custom Attributes: All serial number custom attributes
- Component Price Attributes
-
In the Sort By drop-down, choose which attribute should be used to sort the results.
The attribute that you select for Sort By needs to be a part of what data you are looping over.
- In the Sort Type: drop-down, select the method that will be used to sort: you can sort text or numbers in ascending order (A to Z, or zero to 9), or in descending order (Z to A, or 9 to zero).
- Select Add Filters? to specify the conditions that will filter out the data that the loop iterates over:
- Data Field: Existing data columns that are search-able in commerce.
- Operator: Enable the comparison of the data field with the value to search for and generate the filter result.
- Attribute Value: Specify the value of the data field.
- Order of Operations: Defines the full expression logic and logical operations between each condition attribute. Each row can be referenced by its index number assigned by the system. By default, all condition rows are AND-ed.
- Click And All to AND all of the condition attributes in the order of their creation (index number).
- Click Or All to OR all of the condition attributes in the order of their creating (index number).
- You do not need to use any order for your attribute indexed while defining the order of operation. The attribute indexes can be referenced multiple times in the order of operation to define the correct condition. The order of operation defined is validated by the system when you click Update or View Code.
-
Click Save to save and update the loop condition.
The Loop section appears in your document, highlighted in light yellow.
- Insert the content to display in the field Enter Content Here.
You can also insert more dynamic element (conditionals, dynamic data, loops, and so on ) inside the content.
- To edit a loop: Click the pencil icon.
The Expression Editor appears. Click View XSL to view the element's XSL. - To delete a loop: Click the red X.
- To add a loop: Click the heart icon.
- Output a list that contains the Part Number of all Part Type Line Items with Lead Time less than 5 days OR Part Base Price less than $100.
- Specify what data you want and how it will be displayed (build the table).
- Create a list.
For the list element, specify a dynamic place holder for Part Number since this is the field you want to display in your list. - Populate the fields you want with the right data from the Transaction (build the loop).
- Select the list that you created above and launch the Loop Expression Editor by clicking Repeating Section in the Dynamic Data tab.
- Follow the steps listed above for "Inserting a Loop"
- For Loop Over: Choose Part Line Items.
This creates a loop that iterates through all the part type line items in your transaction. - For Sort By: Choose Part Number.
This sorts the results in alphabetical order. - Create a filter that returns part line items with lead times less than 5 days or part base price less than $100:
- Choose the first data field as Lead Time. Specify that Lead Time < 5.
- Choose the second data field as the User Currency Preference. Specify that Currency Preference = USD.
- Choose the third data field as Part Base Price. Specify that Part Base Price < 100.
- In the Row Grouping field, group the conditions like this: (1 OR (2 AND 3)).
- For Loop Over: Choose Part Line Items.
This editor helps in specifying and editing conditions for the selected area in the page or document. If the condition is met, then the selected node(s) will be hidden in the output.
- Place your cursor at a point in the page where you would like to insert a conditional.
- From the Dynamic tab, click Conditional to open the Condition Expression Editor.
-
Enter a Name and Description for the condition.
- Add filters to specify the conditions. Complete the following information:
- Data Field: Select from the existing data columns that are search-able in commerce.
- Operator: Select from the list of operators in the field by clicking the field.
The operators enable the comparison of the data field with the value to search for and generate the filter result. - Attribute Value: Specify the value of the data field.
- Order of Operations: Use this section to define the full expression logic and logical operations between each condition attribute. Each row can be referenced by its index number assigned by the system.
By default, all condition rows are AND-ed.- Click And All to AND all of the condition attributes in the order of their creation (index number).
- Click Or All to OR all of the condition attributes in the order of their creating (index number).
- You do not need to use any order for your attribute indexed while defining the order of operation. The attribute indexes can be referenced multiple times in the order of operation to define the correct condition. The order of operation defined is validated by the system when you click Update or View Code.
-
Click Save to save changes.
If this is a new condition, it will now appear on your document highlighted in Orange.
- Click Cancel to exit the Expression Editor without saving changes.
-
In the IF element, insert the contents where it says, Enter Content Here.
You can also insert more dynamic elements (conditionals, dynamic data, repeating section, and so on) inside of the content.
Click Add Row to add another row to the filter.
-
In the conditional "IF" section icon, double-click the green " + ".
An ELSE block should appear below the "IF" content.
-
Edit the content in the dotted box which will display if the condition in the "IF" is not met.
This removes all content inside the ELSE block.
Example: Conditional Formatting
In a contract, show a section named "For California Buyers" only to buyers from California. Buyers from other states should not see this section in the contract.
- Name the section: "For California Buyers" - use the rich text editor to author the content.
- Hide the section: Select the "For California Buyers" text and launch the Conditional Expression Editor.
- In the Data Fields, choose the CRM Attribute "Buying State Province".
-
Specify the condition "Buying State Province = California".
When a buyer who is not from the state of California logs in, the condition is met and the section is hidden. For a buyer from California, the condition is false and the text is therefore no longer hidden.
Data Formatting Expression Editor
Use the Data Formatting Expression Editor to define and edit the format for dynamic data without having to use any coding.
- Source: This indicates that the dynamic commerce data will be derived from the current process.
- Name: Enter a name for the dynamic data that you want to format. This is a required field. The text name is not unique.
- Description: Enter a valid description for the data to be formatted.
- Data Selected: This is a read-only field that indicates that the dynamic data field was selected.
- Formatting: Use the tree drop-down to select the function(type) to be applied to the data. This function will be applied to the dynamic data from the commerce XML. The result of applying the function on the data is displayed on the output.
- Update: Click Update to update the loop condition in the database.
- Cancel: Click Cancel to cancel the loop condition definition.
- Parameter Grid: This section displays parameters of the formatting function. The number of parameters and the type of parameter depends on the function that is chosen in the Formatting section.
- Name: Provides a name for the parameter that is expected by the function picked in the Formatting field
- Value: Edit the values of the parameters in the Value field.
We support dynamic values for currency-code and value multiplier in printed documents. There are additional parameters that control rounding and display of currency symbol. Multi-currency applications can take advantage of this feature to print price and discount attributes in any supported currency regardless of the currency of the current user of the currency in which the document was initially created.
Currency Function Parameter | Description |
---|---|
Currency_code |
Pass a global XSL variable name in this field so that currency is shown depending on the logic specified by the FullAccess user. The default value is the current user's preferred currency. |
Multiplier |
Pass a global XSL variable name in this field so that the correct multiplier is applied on the logic specified by the FullAccess user in the global XSL snippet. The default value is 1. |
Enable Currency Rounding |
When enabled, this option will round the currency value. The default value is false. |
Show Currency Symbol |
When this option is enabled, the currency symbol shows, depending on the currency specified in the currency-code parameter. The default value is true. |
Goal: The cover letter must be addressed to the Name of the Buyer. The name of the buyer is the user's name contained in the email address. For example, if the user's email is dvader@empire.com, then the letter must be addressed to dvader.
Solution:
- Specify what data you want: Drag and Drop the User Email Dynamic Data at the selected node in the document page.
- Format your data:
- In the Formatting section, choose substring-before.
- In the Value section, specify @. This returns the string before the "@". In our example, when the email is dvader@empire.com, it returns dvader.
Administration
Formatting Expression Editor Parameters:
When defining a format in the Formatting Expression Editor, use the tree drop-down to select the function(type) to be applied to the data. This function will be applied to the dynamic data from the commerce XML. The result of applying the function on the data is displayed on the output.
Function | Parameters | Description |
---|---|---|
normal-size | None | Trims any extra white space before and after the data value. |
count | None | Returns the number of times the data value occurs. |
sum | None | Returns the sum of the numerical value of each node in the data value. |
Function | Parameters | Description |
---|---|---|
substring |
start-index: {number} starting position to take the substring from; length: {number} length of string to take |
Returns the substring of the data value starting at the start-index with length of length. For example, if the data value is "12345", then |
substring-after | search string: {text}: starting position to take the substring from |
Returns the substring of the data value that follows the first occurrence of the search string, or the empty string if the search string was not found. For example, if the data value is "1999/04/01", then |
substring-before | search string: {text}: starting position to take the substring from |
Returns the substring of the data value that precedes the first occurrence of the search string, or the empty string if the search string was not found. For example, if the data value is "1999/04/01", then |
concat | param 1: {text} string to concatenate to end of a data value | Returns the concatenation of its arguments. |
string-length | None | Returns the number of characters in the data value. |
translate | search-characters: {text} starting position to take the substring from; replace-characters: {text} length of string to take |
Returns the data value with occurrences of characters in the search-characters parameter replaced by the character in the replace-character parameters. For example, if the data value is "bar", then translate("abc", "ABC") returns the string "BAr". If there is a character in the search-characters parameter with no character at a corresponding position in the replace-characters parameter, then occurrences of that character in the first argument string are removed. For example, If a character occurs more than once in the search-characters parameter, then the first occurrence determines the replacement character. If the replace-characters parameter is longer than the search-characters parameter, then excess characters are ignored. |
Most of these functions are standard XSLT functions. Detailed documentation on parameters can be found on XSLT reference web sites such as: http://www.devguru.com/technologies/xslt/home
Function | Parameters | Description |
---|---|---|
format-number | format-number: {text} Required- Specifies the format pattern; decimal-format: {text} Optional |
Converts the data value into a formatted string. Characters used in the formatting pattern:
|
currency | currency-code: {text} Required | Formats a number into a currency string. |
round | None | Rounds the data to the nearest integer. |
floor | None | Returns the largest integer that is not greater than the data value. |
ceiling | None | Returns the smallest integer that is greater than the data value. |
There are no predefined functions available to format dates as dd.MM.yyyy or dd/MM/yyyy. Write custom XSL to achieve this formatting.
Function | Parameters | Description |
---|---|---|
shortdate | separator: {text} Required. The delimiter to use, "/" in the example to the right. | Formats an Oracle CPQ date attribute into a short-hand readable format such as 2/12/2008. |
longdate | separator: {text} Required though not used. Enter anything into this field. | Formats an Oracle CPQ date attribute into a long-hand readable format, such as February 12, 2008. |