Changes

Jump to: navigation, search

Custom Field Type: Special - Advanced Data Table

1,541 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)==
if(result==0)
saveFunc();
}
</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>
# For '''Field Type''' select '''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 XML example '''@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 Advanced Data Table field and click '''Save''' (this updates the linkage and ensures when data is entered into the worksheet the data displayed on the object will also get automatically updated. If you miss this step, 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 Data==
* Return a single value in the total row of a Dynamic XML.
<pre>@xml.fieldname.sectionnodename.rownodename.total.columnnodename.nodevalue@</pre>
==Styling XML data 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]]
Note:
# Make Sure sure your Advanced Data Table has 8 or less columns to ensure it will print and fit on screen.# If the user is expected to enter paragraphs of information , do so in a new row or new section, instead of adding another column.
# If your worksheet does not look as expected make sure '''Apply Default Styles''' is toggled on in the '''Section Builder''' and then click '''Build''' on 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.
====Uploading the external CSS files and getting the relative links====
Note:
1. Under Display you can customize the Button Label. To meet with Accessibility guidelines you must change the button label from '''Open''' 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 generic link that says '''open''' or '''click here''' as that does not provide enough information when read out of context.
2. Sections must contain 8 or less columns to render properly and be usable.
 
===Styling XML Data for Printing===
You can print your XML if you are displaying it in a '''Read Only - System Variable'''. Size your your XML to fit within 700 pixels wide (portrait) or 900 pixels wide (landscape) to avoid content cutting off, when a PDF is generated. If you have more than one section and more than a few columns, some of your content may cut off when printed if it is not sized. You will also notice columns between sections do not align. To fix this, we will use CSS in a SmartFolder and amend our '''Read Only - System Variable''', which is displaying the XML information.
 
Wrap the content in your read only system variable with a div and give the div a class. We do this to control the width. Wrap the section syntax in a div and give it a class. We do this so we can control the size of cells and the fonts. e.g.
 
<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.g.
 
<pre>@charset "utf-8";
/* CSS Document */
.LeftAlign {text-align: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,301
edits

Navigation menu