Changes

Jump to: navigation, search

Custom Field Type: Special - Advanced Data Table

4,759 bytes added, 19:12, 10 September 2020
Access, Display and Format options for Data
{{Show Clear Button}}
 
{{Display fields refreshed upon edit}}
{{Custom Field Ids}}
=Configuration - Essentials=
==Creating the field==
Typically XML Advanced Data table custom fields are created for UTA level 1, 2 or 3, (e.g. a grant application) or they are created for organizations. To create the field:
# Navigate to the desired settings area where you want to create a worksheet (e.g. the UTA level 1).
==Adding a formula to a cell (working with data in the same section)==
 
# Navigate to your custom field.
# Click the '''Section Builder''' button in the action bar.
e.g. '''=[@section.''expense''.id@_''Total_Amount'']-[@section.''income''.id@_''Existing-funds''_''Amount'']'''
 
 
If you need want to display data in the head of a section (row 0) from another section you can use the following:
 
'''@xml.customfieldname.sectionnodename.rownodename.columnnodename@'''
==Validate values when saving the worksheet==
<pre>parseInt([this])>0</pre>
Message: Please provide a numeric value greater than 0.
 
 
* Value entered in one cell cannot be more than 20% above or below the value in another cell
 
<pre>(ssParseNum([this])>=(ssParseNum([1,4])*(0.80)) && ssParseNum([this])<=(ssParseNum([1,4])*1.20))</pre>
Message: Value entered in one cell cannot be more than 20% above or below the value in another cell
 
 
==Validating values when saving record (SmartCheck, Submit Logic, Browser Script)==
In addition to validating values when you save the XML worksheet you can also validate the XML worksheet when you save the record (e.g. save a level 1 grant application).
When creating validation for an XML this custom field use the '''Appear Mandatory''' option. Appear mandatory does not enforce the validation but will make the field look mandatory (add it adds the asterisk and or color) just like the mandatory option. Once you have checked '''Appear Mandatory''', validate the XML worksheet this field using one of the following validation methods, when the record is saved.
===SmartCheck Validation===
Use SmartCheck for XML validation when possible. SmartCheck validation is a secure server -side method. SmartCheck also displays all error messages in a context as well as in one central place.
Validate an XML a table node is not empty and display a message.
<pre>if("@level1.xml.fieldname.sectionnodename.rownodename.columnnodename.nodevalue@"=="")
===Submit Logic Validation===
Use Submit Logic in conjunction with Submit Buttons to Validate a XML worksheet.
Check an XML a node in not blank when saving the XML worksheet.
<pre>"@level1.xml.fieldname.sectionnodename.rownodename.columnnodename.nodevalue@"!=""</pre>
</pre>
The following function allows you to check for an already selected value from an existing row when using dynamic rows on multiple sections:
 
<pre>
var saveFunc=saveXML;
saveXML=function() {
if (checkdupeval_Section1() == 0 && checkdupeval_Section2() == 0 && checkdupeval_Section3() == 0) {
saveFunc();
}
 
}
function checkdupeval_Section1() {
var result = 0;
var numOfRows = document.getElementsByName('16580_row_COUNTY'); // REPLACE '16580_row_COUNTY' AND '16580_row_COUNTY_' WITH SPECIFIC XML sectionid_rownodename_columnnodename for Section 1
var ctr=1;
for (ctr=1;ctr<numOfRows.length;ctr++)
{
var field1='16580_row_COUNTY_'+ctr;
var lastfield='16580_row_COUNTY_'+numOfRows.length;
var a = document.getElementById(field1).value;
var b = document.getElementById(lastfield).value;
if( a == b)
{
alert ("Please list each option no more than once for Section 1.");
result = 1;
}
}
return result;
 
}
 
function checkdupeval_Section2() {
var result = 0;
var numOfRows = document.getElementsByName('16581_row_COUNTY'); // REPLACE '16581_row_COUNTY' AND '16581_row_COUNTY_' WITH SPECIFIC XML sectionid_rownodename_columnnodename for Section 2
var ctr=1;
for (ctr=1;ctr<numOfRows.length;ctr++)
{
var field1='16581_row_COUNTY_'+ctr;
var lastfield='16581_row_COUNTY_'+numOfRows.length;
var a = document.getElementById(field1).value;
var b = document.getElementById(lastfield).value;
if( a == b)
{
alert ("Please list each option no more than once for Section 2.");
result = 1;
}
}
return result;
}
 
function checkdupeval_Section3() {
var result = 0;
var numOfRows = document.getElementsByName('16582_row_COUNTY'); // REPLACE '16582_row_COUNTY' AND '16582_row_COUNTY_' WITH SPECIFIC XML sectionid_rownodename_columnnodename for Section 3
var ctr=1;
for (ctr=1;ctr<numOfRows.length;ctr++)
{
var field1='16582_row_COUNTY_'+ctr;
var lastfield='16582_row_COUNTY_'+numOfRows.length;
var a = document.getElementById(field1).value;
var b = document.getElementById(lastfield).value;
if( a == b)
{
alert ("Please list each option no more than once for Section 3.");
result = 1;
}
}
return result;
 
}
</pre>
==Managing Level 2 / 3 Activities with an XML a Section==System administrators can configure XML fields this field to add, modify or delete {{l2}} records on a {{l1}} entity or {{l3}} records on a {{l2}} entity.
In the [[XML '''Section Builder]]''', when the ''Number of Rows'' for a Section is set to '0', the ''Enable Mapping'' option will be shown.
[[Image:XMLEnableMapping2017.png|link=|800px|border]]
When '''Enable Mapping''' is selected, you can choose one type of activities to be referenced by the XML this field.
The '''Activity Status Filter''' setting allows you to filter the activities to be referenced by status.
The '''Additional Filter''' setting allows you to select custom fields and associated values. These are used to filter the existing activities that will be listed within the XMLthis field. The custom fields used have to be those fields with pre-defined options (e.g. [[Custom Field TypeCustom_Field_Type: _Select_One_-_Dropdown_List|Select One – Combo Box|Combo box- Dropdown List]], and [[Custom Field TypeCustom_Field_Type: _Select_Many_–_Check_Boxes|Select Many – Check Boxes|Check Boxes]], [[Custom Field Type: Dynamic Data – Dynamic Control Field|Dynamic Control]], Ajax Lookup).
[[Image:XMLEnableMappingFilter2017.png|link=|650px|border]]
When building your section, you will need to map the fields on the {{l2}}s that will be referenced by the XML section.
For each Section column, enter the field name from the Level 2 type that you have selected from the '''Activity Type''' dropdown in the '''Map Field''' section:
[[Image:MappingL2Fields2017.png|link=|800px|border]]
The syntax for the '''Map Field''' section is:
* for [[custom fields]], simply the field name (i.e., '''Fund Name''');* for [[standard fieldStandard_Field|Standard Field]]s, use the prefix '''sf_''' and then the system name for the standard field (i.e., '''sf_status''').
: ''see [[Standard Level 2 Field List]] article for a list of system names for {{l2}} standard fields.
If the Standard or Custom field has a limited number of pre-defined options then these need to be defined in the Content section of the cell properties.
When this section is added to the XSL Template of your XML field, the list of {{l2}} activities will be displayed when the XML worksheet is opened. Level 2s can be added, deleted and modified directly from the {{l1}} XML Advanced Data Table field.
=Displaying XML Data=
==Displaying XML Advanced Data Table data on an object==
[[File:xml-readonly.png|500px|border|The XML displayed in a read only]]
The XML Advanced Data Table custom field opens can open in a new or modal window and . The '''Open in Modal Window''' option is recommended. You can toggle this on under '''Document Options'''. By default the information entered into this field type is hidden until the user must click clicks a button . But there is a way to launch the modal window and see the information entered. You can however, display the information entered into a '''Special - XML Data''' custom this field on your object, such as a grant application, without requiring the user to click a button and launch the modal window. To do this we use  Use the '''Read Only – System Display - Text and Variables''' custom fieldto display the content of the Advanced Data Table on the object. The same syntax can be used elsewhere in the system (e.g. include Display Only - Web Page View, Special MS Word Merge, visibility conditions, etc.) when referencing the xml this field's values.
# Go to the desired location where you want to create the custom field.
# Click the '''New Field''' (+) button in the action bar.
# For '''Field Type''' select '''Read Only – System Display - Text and Variables'''.
# Enter a '''Field Name'''.
# For '''Variables''' enter '''@xml.''CustomFieldName''.''SectionNodeName''.html@''' (replace the '''CustomFieldName ''' and '''SectionNodeName ''' with the actual names from your XMLexample '''@xml.Budget.Expenses.html@''').
# Scroll Down to the '''Display''' section.
# For '''Caption''' select '''Hide Caption''' (we recommended that you hide the caption for the display so that you can utilize the full screen width).
# Click '''Save'''.
# Navigate back to the XML custom Advanced Data Table field and click '''Save''' ('''Display Fields Refreshed Upon Edit''' will be updated with this updates the linkage and ensures when data is entered into the custom field ID of worksheet the Read Only we just created. From now data displayed on when a user edits the XML the read only object will be also get automatically updated. If you miss this step it , information entered into the Advanced Data Table will only refresh in the Display - Text and Variables field when the object is saved).
Note: you may want to create two '''Display - Text and Variables''' custom fields for each '''Advanced Data Table''' custom field. One that you will use for printing and one for displaying on the object.
==Access, Display and Format options for XML Data==The syntax options for accessing, displaying and formatting the data from the XML fields are Advanced Data Table field is detailed below.
* Return multiple rows for XML with dynamic sections in a custom html table.
<pre>@xml.fieldname.sectionnodename.rownodename[# #]@</pre>
{|border="1"
|-
||~columnodename.nodevalue~
* Return a single value in the total row of a Dynamic XML.
<pre>@xml.fieldname.sectionnodename.rownodename.total.columnnodename.nodevalue@</pre>
==Styling Advanced Data Table for web, print and conversion to PDF==
[[File:xml-readonly-styled.png|500px|border|The worksheet styled at 700 pixels wide in a Display Text and Variables custom field]]
==Styling XML To ensure data for web entered into an '''Advanced Data Table''' fits on screen and print (will converted to a PDF)==[[File:xml-readonly-styledwithout having data cut off, administrators need to upload two external CSS style sheet to a SmartFolder, reference it on the '''Advanced Data Table''' and the '''Display Text and Variables''' fields as well as add some code to both of these fields.png|500px|border|The XML styled at 700 pixels wide in a read only]]
If you enable the '''Section Builder''' and '''Apply Default Styles''' is enabled in each section of your XML custom field, the field will be automatically styled. If you have manually added CSS classes to your cells, you will need to remove those classes and check '''Apply Default Styles''' again and then click '''Build''' on your XML in section builder.Note:
Administrators with CSS knowledge can modify the look # Make sure your Advanced Data Table has 8 or less columns to ensure it will print and feel of their XMLs (e.g. make columns wider or thinner)fit on screen. To modify # If the look and feel user is expected to enter paragraphs of your XMLinformation, create an external CSS style sheet, upload the style sheet to do so in a SmartFoldernew row or new section, add classes to the elements instead of adding another column.# If your worksheet does not look as expected make sure '''Apply Default Styles''' is toggled on in your XML, and add a link to the style sheet in your '''Special - XML DataSection Builder''' or and then click '''Read Only - System VariableBuild''' custom fieldson each of your sections in the section builder.
===Styling the Advanced Data Table for viewing onscreen===
Ensure the columns and rows of your '''Advanced Data Table''' look good onscreen, when a user enters information, by following the steps below.
===Styling XML Data for Printing=Uploading the external CSS files and getting the relative links====You can print # Download the CSS files [[File:CSS.zip|CSS.zip]]# In your XML if you are displaying desired instance navigate to the Menu Icon and choose '''SmartFolders'''# If it in does not exist already create a '''Read Only - New Folder''' and call it '''System VariableFiles'''# Upload the CSS files found inside the Zip file you downloaded in step 1# Inside SmartFolders in the column called '''File Options''' for the desired file select '''View URL''' from the drop down. Size your your XML This will give you the absolute path to fit within 700 pixels wide (portrait) or 900 pixels wide (landscape) the file you uploaded# Copy this link that starts with '''https:''' and ends with '''/CSS_for_XSL_onscreen_1290.css'''.# Remove the first part of the link before the '''/files...''' to avoid content cutting off, when make it a PDF is generatedrelative link. If you Absolute links can have more than one section an adverse affect on your instance and more than they won't work as expected on your backup. So Always convert the absolute link to a few columns, some of your content may cut off when printed if it is not sizedrelative link. You Your relative link will also notice columns between sections do not alignlook like '''/files/000000/f000000/CSS_for_XSL_onscreen_1290. To fix css'''# Save this, we will use CSS relative link in a SmartFolder and amend our text file so we can add it to each '''Read Only - System VariableAdvanced Data Table''', custom field in your instance.# Repeat steps 5 to 8 for the second CSS file which is displaying will be used for rendering on the XML informationobject and in the PDF.
Wrap ====Modifying the Advanced Data Table template====# Download the templates used for the '''Advanced Data Table''' and the '''Display Text and Variables''' fields [[File:TEMPLATES.zip]].# In the desired '''Advanced Data Table''' Field paste the content from the xsl_template_1290 file you downloaded, into the XSL Template input.# Change the href in your read only system variable with a div and give the div a class. We do this link to the relative URL that points to the CSS file you previously uploaded to control the widthSmartFolder (Example href="/files/000000/f000000/CSS_for_XSL_onscreen_1290"). Wrap # Update the text called '''Title''' in two places inside the XSL template.# Update '''@section syntax .Section Node Name@''' with the '''Section Node Name''' you want to display.# Modify the class wrapper with the amount of columns in your section. Example '''class="xml6col"''' is for a div and give 6 column section. If you have 2 columns, change it a to '''class="xml2col"'''. We do this so we can control the size of cells and # Save the fonts. e.gAdvanced Data table Field.
<div class="xml700"><div class="xmlTitleBar">Title Bar Name</div><div class="xml3col">@xml.fieldname.sectionnodename.html@</div></div>Now create a CSS file. e.gwhen you click the button to open the Advanced Data Table you will see your columns will render nicely and they will be equal in width.
<pre>@charset "utf-8";/* CSS Document */.LeftAlign {text-alignNote:left;}.RightAlign {text-align:right;}.xml700 {width:700px;}.xml3col .xmlLabel {width:470px; min-width:470px; max-width:470px;}.xml3col .xmlCell {width:80px; min-width:80px; max-width:80px;}.xml3col .xmlCell.note {width:150px; min-width:150px; max-width:150px;} </pre> Go to the desired SmartFolders and upload your CSS file. Use '''View URL''' to get the path to the CSS file. Then add the relative link back into your '''Read Only - System Variable'''. e.g. Add the class '''RightAlign''' to the desired cells in the section builder.If you want to make one cell larger than the others, add a custom class to that cell in the section builder e.g. <pre>.xml3col .xmlCell.note {width:150px; min-width:150px; max-width:150px; font-size:12px}</pre>
I # Under Display you can add customize the Button Label. To meet with Accessibility guidelines you must change the button label from '''noteOpen''' to something meaningful like '''Modify Budget'''. The user must know what the button will do based on the text in the button. You cannot have a cell generic link that has xmlCell in a section wrapped in a div with a class says '''open''' or '''xml3colclick here''' as that does not provide enough information when read out of context by a screen reader.# Sections must contain 8 or less columns to render properly and that cell will become 150 pixels widebe usable.
Note: ===Styling Advanced Data Table for Converting to PDF and Printing===You can print your cells Advanced Data Table content by displaying it in a '''Display Text and Variables''' custom field. In order to do this the content must add up to fit within 700 pixels if you are displaying your budget in wide (portrait) or 900 pixels wide (landscape) otherwise content will cut off when a portrait PDF on letter size paper (8is generated.5 x 11”)To ensure content does not cut off and to ensure columns between sections align, we will use CSS in a SmartFolder and amend our '''Display Text and Variables''' custom field.
# Navigate to the desired '''Display Text and Variables'''.
# Paste the contents of '''display.html''' into the '''Content''' section of the field.
# update the href to point to the relative path to the file called '''xml-print.css''' that you uploaded to the SmartFolders.
# Add your desired variable example '''@xml.Budget.Expenses.html@''' inside the div with the '''class="xml8col"'''.
# Change the '''8''' in '''class="xml8col"''' to the number of columns in your section. Note you must have 8 or less columns.
# If you want this table to be displayed wider for landscape printing add the word '''landscape''' in the class example '''class="xml8col landscape"'''.
# Save your custom field
You now have a version of your Advanced Data Table that you can display on the object such as the level 1 application and you can convert this to a PDF using the Web Page View custom field.
===Using different styles for Print and Web with XML Data===You can have one look for your XML when it is onscreen and another when it is in PDF format for printing. To do this, create If you created two '''Read Only Display - System Text and Variables''' custom fields, create two CSS style sheets in one for printing and one for onscreen. The above instructions are for the print version as it will reduce the font size and constrain the content to 700 pixels. In this print version use the setting '''SmartFoldersSmartFields View''' and reference the desired style sheet in the desired choose '''Read Only - System VariablesInclude'''. Then on This will include this field in the PDF. On the second '''Read Only Display - System Text and Variables''' intended for viewing on screen for use '''SmartFieldsView''' View and choose '''Exclude'''. This custom field will no longer be included in PDFs generated using hide the onscreen version from the SmartFields variablePDF. For Lastly for the other custom field onscreen version you want to do not use the xml-print, choose '''Only display for SmartFields View'''. Now one '''Read Only - System Variables''' will appear on screen and another when css or the PDF is created, and you can have a separate style sheet to control the look and feel of bothdiv wrappers.
==Reporting on XML Advanced Data Table data==Extract XML value values in a report using the following syntax in the report builder. This will return one value for static XML sections specific to the row and multiple values for Dynamic XML sections across all rows.
<pre>ExtractValue([this], '/worksheet/sectionnodename/rownodename/columnnodename')</pre>
 
==Example of XML field==
Here is an example of an XML field with one section (Expenses) 3 static rows (Salaries, Supplies and Total) and 3 columns (Amount, Notes and Date).
 
<pre><!--?xml version="1.0" encoding="UTF-8"?-->
 
50000
People I work with
2016-11-30
30000
Things I need
2016-11-30
8000
2016-11-30
</pre>
{{CustomFieldPageFooter}}
[[Category:XML]]
Smartstaff, administrator
3,314
edits

Navigation menu