Changes

Jump to: navigation, search

Custom Field Type: Special - Advanced Data Table

4,612 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 print (conversion to PDF)==[[File:xml-readonly-styled.png|500px|border|The XML worksheet styled at 700 pixels wide in a read onlyDisplay Text and Variables custom field]]
If you enable the To ensure data entered into an '''Section BuilderAdvanced Data Table''' fits on screen 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 converted to your cellsa PDF without having data cut off, you will administrators need to remove those classes and check upload two external CSS style sheet to a SmartFolder, reference it on the '''Apply Default StylesAdvanced Data Table''' again and then click the '''BuildDisplay Text and Variables''' on your XML in section builderfields as well as add some code to both of these fields.
Administrators with CSS knowledge can modify the look and feel of their XMLs (e.g. make columns wider or thinner). To modify the look and feel of your XML, create an external CSS style sheet, upload the style sheet to a SmartFolder, add classes to the elements in your XML, and add a link to the style sheet in your '''Special - XML Data''' or '''Read Only - System Variable''' custom fields.Note:
# Make 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 XML the Advanced Data Table for Printingviewing onscreen===You can print Ensure the columns and rows of your XML if you are displaying it in a '''Read Only - System VariableAdvanced Data Table'''. Size your your XML to fit within 700 pixels wide (portrait) or 900 pixels wide (landscape) to avoid content cutting offlook good onscreen, 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'''user enters information, which is displaying by following the XML informationsteps below.
Wrap ====Uploading the content in external CSS files and getting the relative links====# Download the CSS files [[File:CSS.zip|CSS.zip]]# In your read only system variable with desired instance navigate to the Menu Icon and choose '''SmartFolders'''# If it does not exist already create a div '''New Folder''' and call it '''System Files'''# 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. This will give you the div a class. We do this absolute path to control the widthfile you uploaded# Copy this link that starts with '''https:''' and ends with '''/CSS_for_XSL_onscreen_1290. Wrap css'''.# Remove the first part of the link before the section syntax in '''/files...''' to make it a div relative link. Absolute links can have an adverse affect on your instance and give it they won't work as expected on your backup. So Always convert the absolute link to a classrelative link. Your relative link will look like '''/files/000000/f000000/CSS_for_XSL_onscreen_1290. We do css'''# Save this relative link in a text file so we can control add it to each '''Advanced Data Table''' custom field in your instance.# Repeat steps 5 to 8 for the second CSS file which will be used for rendering on the size of cells object and in the fonts. e.gPDF.
<div class="xml700"><div class===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 the link to the relative URL that points to the CSS file you previously uploaded to the SmartFolder (Example href="xmlTitleBar/files/000000/f000000/CSS_for_XSL_onscreen_1290">).# Update the text called '''Title Bar ''' in two places inside the XSL template.# Update '''@section.Section Node Name</div>@''' with the '''Section Node Name''' you want to display.<div # Modify the class wrapper with the amount of columns in your section. Example '''class="xml3colxml6col">@xml''' is for a 6 column section.fieldnameIf you have 2 columns, change it to '''class="xml2col"'''.sectionnodename.html@</div></div>Now create a CSS file. e.g# Save the Advanced Data table Field.
<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 {Now when 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: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 {widthNote: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