Difference between revisions of "XML Section Builder"

From SmartWiki
Jump to: navigation, search
(Builder)
 
(25 intermediate revisions by 10 users not shown)
Line 1: Line 1:
 +
<table class="wikitable"><tr><td style="padding: 10px;"><big>This page has been deprecated</big></td><td style="padding: 10px;">See [[Custom Field Type: Special - XML Data]]</td></tr></table>
 +
 +
__TOC__
 +
 
The XML Section Builder can be used to create XML templates without knowing advanced HTML or XML.  
 
The XML Section Builder can be used to create XML templates without knowing advanced HTML or XML.  
  
Line 4: Line 8:
 
* Select the '''Enable Builder''' checkbox on the custom field settings page and click Save.
 
* Select the '''Enable Builder''' checkbox on the custom field settings page and click Save.
 
* Click the '''Section Builder''' button at the top of the page to enter the builder.
 
* Click the '''Section Builder''' button at the top of the page to enter the builder.
 +
  
 
==Builder==
 
==Builder==
  
* Node names must not be blank, must not contain spaces, and must not start with a number. (Disallowed initial characters for Names include digits, diacritics, the full stop and the hyphen.) If users try to build a section with these issues then they will receive an alert.
 
  
[[Image:XMLSectionIssues.png|link=|700px]]
+
* Node names must not be blank, must not contain spaces, parentheses, brackets, percent sign, and must not start with a number. (Disallowed initial characters for Names include digits, diacritics, the full stop and the hyphen.) If users try to build a section with these issues then they will receive an alert.
 
+
 
* CSS classes specified can either be the system defined classes, or you can create your own CSS classes and include them in the &lt;style> tag on the Template
+
:[[Image:XMLSectionIssues.png|link=|700px]]
 +
 
 +
'''You cannot have the same node names across different sections levels in the xml.''' If there is a Section Node name called "Infrastructure" then it can't be used as a row node name or column node name for any other sections.
 +
 
 +
* CSS classes specified can either be the system defined classes, or you can create your own CSS classes and include them in the &lt;style> tag on the Template. (See [[Adding Styles to XML Worksheets]] for instructions)
 
* The formula can refer to other cells within the section using the following syntax:
 
* The formula can refer to other cells within the section using the following syntax:
* <font size="2">'''[row#,column#]'''</font>
+
:<font size="2">'''[row#,column#]'''</font>
 
Example:
 
Example:
 
  =[1,1]+[1,2]
 
  =[1,1]+[1,2]
 
* The formula can refer to fields in other sections using the following syntax:
 
* The formula can refer to fields in other sections using the following syntax:
* <font size="2">'''[@section.'''''yoursectionname'''''.id@_'''''rowname_colname''''']'''</font>
+
:<font size="2">'''[@section.'''''yoursectionname'''''.id@_'''''rowname_colname''''']'''</font>
 
Example:
 
Example:
 
  =[@section.InternalFunding.id@_Total_Amount]/[@section.TotalFunding.id@_Total_Amount]*100
 
  =[@section.InternalFunding.id@_Total_Amount]/[@section.TotalFunding.id@_Total_Amount]*100
Line 25: Line 33:
 
* ''Type:'' this is the type of cell, (Single Line Text, Multiple Line Text, Display Only Text, Select One Combo Box)
 
* ''Type:'' this is the type of cell, (Single Line Text, Multiple Line Text, Display Only Text, Select One Combo Box)
 
* ''Content:'' Text to display in the cell or formula for calculations (Examples: ''Total'' or ''=[1,2]+[2,2]'' or ''=[35_Total_Amount]+[36_Total_USD]'')
 
* ''Content:'' Text to display in the cell or formula for calculations (Examples: ''Total'' or ''=[1,2]+[2,2]'' or ''=[35_Total_Amount]+[36_Total_USD]'')
* ''Cell CSS Class:'' Add CSS class to the table cell
+
* ''Cell CSS Class:'' Add a CSS class to the table cell
 
* ''Input CSS Class:'' Add a CSS class to the input field
 
* ''Input CSS Class:'' Add a CSS class to the input field
 
* ''Input Attributes:'' Add HTML attributes to the input field (Example: ''name, size'')
 
* ''Input Attributes:'' Add HTML attributes to the input field (Example: ''name, size'')
* ''Validation Script:'' Script to validate the input field (Example: ''[this]>100'' or ''[this]==[35_Total_Amount]'')
+
* ''Validation Script:'' Script to validate the input field. Examples are shown in the section below.
 
Note:
 
Note:
 
<pre style="white-space: pre-wrap;  
 
<pre style="white-space: pre-wrap;  
Line 35: Line 43:
 
  white-space: -o-pre-wrap;  
 
  white-space: -o-pre-wrap;  
 
  word-wrap: break-word;">
 
  word-wrap: break-word;">
If the column on which you want to apply the validation on has a 'Currency' formatting then you will have to convert the data into a number before you perform the validation.
+
If the column on which you want to apply the validation on has a 'Currency' formatting, you will have to convert the data into a number before you perform the validation.
 
</pre>
 
</pre>
  
Line 44: Line 52:
 
  white-space: -o-pre-wrap;  
 
  white-space: -o-pre-wrap;  
 
  word-wrap: break-word;">
 
  word-wrap: break-word;">
To check if the amount entered is always greater than 0 for a column which has a currency formatting use the built in ssParseNum function to convert the amount to a number.
+
To check if the amount entered is always greater than 0 for a column which has a currency formatting, use the built in ssParseNum function to convert the amount to a number.
 
ssParseNum([this])>0
 
ssParseNum([this])>0
 
</pre>
 
</pre>
 +
 +
See [[ssParseNum]] for additional information.
 +
 
* ''Validation Message:'' Alert when validation script is not true (Example: ''This value must be greater than 100'')
 
* ''Validation Message:'' Alert when validation script is not true (Example: ''This value must be greater than 100'')
 +
 +
 +
==XML Validation Examples==
 +
===Total Amount greater than 0===
 +
Specifically for validation of Currency formatted column totals.
 +
<pre>ssParseNum([this])>0
 +
 +
Total must be greater than $0.00</pre>
 +
 +
===Date is at least 30 days in the future===
 +
<pre>(datediff('@date(currentdate)@',ConvertDateStr([this],'@dateformat@'),'d')) > ('30') && [this].length>0
 +
 +
Please select a date that is at least thirty (30) days from today.</pre>
 +
 +
===Cell is not empty===
 +
<pre>[this].length>0
 +
 +
Please provide a value.</pre>
 +
 +
===Default not selected in Combo Box===
 +
<pre>[this]!="Default Combo Box Value"
 +
 +
Please select a value.</pre>
 +
"Default Combo Box Value" should be substituted with the default value you have configured, ex. "Select One"
 +
 +
===Integer greater than 0===
 +
Allow only an integer or if your field on the XML is formatted to display/use a comma.
 +
<pre>parseInt([this])>0
 +
 +
Please provide a numeric value greater than 0.</pre>
 +
 +
===Validate a Date Field From a Level 2 XML Against a Level 1 Field===
 +
This will check if a date field on the application has been updated and validate the date field against it.
 +
E.g. Activity Completion Date cannot exceed Project End Date
 +
<pre>"@parent.Project End Date@"!="" && ConvertDateStr([this],'@dateformat@')<ConvertDateStr('@parent.Project End Date@','@dateformat@')
 +
 +
Please ensure that the Project End Date has been populated and is not greater than the Completion Date.
 +
</pre>
  
 
==Template==
 
==Template==
 
Within the XML Field template you can pull the sections you have created using the following syntax:
 
Within the XML Field template you can pull the sections you have created using the following syntax:
* <font size="2">'''@section.'''''sectionname'''''@'''</font>
+
:<font size="2">'''@section.'''''sectionname'''''@'''</font>
  
 
Example
 
Example
Line 63: Line 112:
 
</pre>
 
</pre>
  
You can also indicate if the section should not be rebuilt by checking the box labelled '''Do Not Rebuild''' and then clicking Save.
+
You can also indicate if the section should not be rebuilt by checking the box labelled '''Do Not Rebuild''' and then clicking Save.<br/>
 
[[Image:XMLNoRebuilt.png|border]]  
 
[[Image:XMLNoRebuilt.png|border]]  
  
Line 73: Line 122:
 
==Dynamic Rows==
 
==Dynamic Rows==
 
With the Section Builder if you create a section and enter the ''Number of Rows'' as '0', the section will automatically put an '''ADD''' button on the page to add rows dynamically, one by one.
 
With the Section Builder if you create a section and enter the ''Number of Rows'' as '0', the section will automatically put an '''ADD''' button on the page to add rows dynamically, one by one.
Each row will also have a Delete ('''DEL''') button to remove that specific row.
+
Each row will also have a Delete ('''DEL''') button to remove that specific row. The ''Maximum Number of Rows'' sets the limit for the number of rows the user can create (When the value is set to '0', the user can create an unlimited number of rows). If the user tries to go above this limit when entering data, the system warns the user by displaying the ''Maximum Reached Message''.
 +
 
 +
'''NOTE:''' The Add and Delete buttons will not appear when you access an XML worksheet from a record that is in [[view mode]].
  
'''NOTE:''' The Add and Delete buttons will not appear when you access an XML worksheet from a record that is currently in view mode.
+
==Enable Mapping==
 +
When a the ''Number of Rows'' for a Section is set to '0', the ''Enable Mapping'' option will be shown. When ''Enable Mapping'' is selected, you can choose one type of {{l2}} activities to be referenced by the XML field. The ''Activity Status Filter'' setting will also become visible, which allows you to filter the {{l2}} activities to be referenced by status.
 +
 
 +
See [[Managing Level 2 Activities with an XML Section]] for further information on activity mapping.
  
 
==See Also==
 
==See Also==
 
* [[Custom Field Type: Special - XML Data]]
 
* [[Custom Field Type: Special - XML Data]]
 
[[Category:Custom Fields]]
 

Latest revision as of 16:38, 19 December 2016

This page has been deprecatedSee Custom Field Type: Special - XML Data

The XML Section Builder can be used to create XML templates without knowing advanced HTML or XML.

To enable:

  • Select the Enable Builder checkbox on the custom field settings page and click Save.
  • Click the Section Builder button at the top of the page to enter the builder.


Builder

  • Node names must not be blank, must not contain spaces, parentheses, brackets, percent sign, and must not start with a number. (Disallowed initial characters for Names include digits, diacritics, the full stop and the hyphen.) If users try to build a section with these issues then they will receive an alert.
XMLSectionIssues.png

You cannot have the same node names across different sections levels in the xml. If there is a Section Node name called "Infrastructure" then it can't be used as a row node name or column node name for any other sections.

  • CSS classes specified can either be the system defined classes, or you can create your own CSS classes and include them in the <style> tag on the Template. (See Adding Styles to XML Worksheets for instructions)
  • The formula can refer to other cells within the section using the following syntax:
[row#,column#]

Example:

=[1,1]+[1,2]
  • The formula can refer to fields in other sections using the following syntax:
[@section.yoursectionname.id@_rowname_colname]

Example:

=[@section.InternalFunding.id@_Total_Amount]/[@section.TotalFunding.id@_Total_Amount]*100

Click on a cell in the section for the Cell Properties, each cell has the following properties:

  • Type: this is the type of cell, (Single Line Text, Multiple Line Text, Display Only Text, Select One Combo Box)
  • Content: Text to display in the cell or formula for calculations (Examples: Total or =[1,2]+[2,2] or =[35_Total_Amount]+[36_Total_USD])
  • Cell CSS Class: Add a CSS class to the table cell
  • Input CSS Class: Add a CSS class to the input field
  • Input Attributes: Add HTML attributes to the input field (Example: name, size)
  • Validation Script: Script to validate the input field. Examples are shown in the section below.

Note:

If the column on which you want to apply the validation on has a 'Currency' formatting, you will have to convert the data into a number before you perform the validation.

Example:

To check if the amount entered is always greater than 0 for a column which has a currency formatting, use the built in ssParseNum function to convert the amount to a number.
ssParseNum([this])>0

See ssParseNum for additional information.

  • Validation Message: Alert when validation script is not true (Example: This value must be greater than 100)


XML Validation Examples

Total Amount greater than 0

Specifically for validation of Currency formatted column totals.

ssParseNum([this])>0

Total must be greater than $0.00

Date is at least 30 days in the future

(datediff('@date(currentdate)@',ConvertDateStr([this],'@dateformat@'),'d')) > ('30') && [this].length>0

Please select a date that is at least thirty (30) days from today.

Cell is not empty

[this].length>0

Please provide a value.

Default not selected in Combo Box

[this]!="Default Combo Box Value"

Please select a value.

"Default Combo Box Value" should be substituted with the default value you have configured, ex. "Select One"

Integer greater than 0

Allow only an integer or if your field on the XML is formatted to display/use a comma.

parseInt([this])>0

Please provide a numeric value greater than 0.

Validate a Date Field From a Level 2 XML Against a Level 1 Field

This will check if a date field on the application has been updated and validate the date field against it. E.g. Activity Completion Date cannot exceed Project End Date

"@parent.Project End Date@"!="" && ConvertDateStr([this],'@dateformat@')<ConvertDateStr('@parent.Project End Date@','@dateformat@')

Please ensure that the Project End Date has been populated and is not greater than the Completion Date.

Template

Within the XML Field template you can pull the sections you have created using the following syntax:

@section.sectionname@

Example

 <table>
    <tr><td>Revenue</td></tr>
    <tr><td>@section.Revenue@</td></tr>
    <tr><td><br>Expenses</td></tr>
    <tr><td>@section.Expenses@</td></tr>
 </table>

You can also indicate if the section should not be rebuilt by checking the box labelled Do Not Rebuild and then clicking Save.
XMLNoRebuilt.png

If this is populated and someone tries to rebuild the section then that user will be presented with the alert below when they click on the Build button.

XMLNoRebuilt2.png


Dynamic Rows

With the Section Builder if you create a section and enter the Number of Rows as '0', the section will automatically put an ADD button on the page to add rows dynamically, one by one. Each row will also have a Delete (DEL) button to remove that specific row. The Maximum Number of Rows sets the limit for the number of rows the user can create (When the value is set to '0', the user can create an unlimited number of rows). If the user tries to go above this limit when entering data, the system warns the user by displaying the Maximum Reached Message.

NOTE: The Add and Delete buttons will not appear when you access an XML worksheet from a record that is in view mode.

Enable Mapping

When a the Number of Rows for a Section is set to '0', the Enable Mapping option will be shown. When Enable Mapping is selected, you can choose one type of Level 2 activities to be referenced by the XML field. The Activity Status Filter setting will also become visible, which allows you to filter the Level 2 activities to be referenced by status.

See Managing Level 2 Activities with an XML Section for further information on activity mapping.

See Also