140 likes | 145 Views
Learn string manipulation techniques, such as concatenation and substrings, as well as working with multi-values and arrays in calculated columns. Also covers date formatting and comparison. September 12-14, 2018 in Raleigh, NC.
E N D
September 12-14, 2018 Raleigh, NC
Commonly Used Calculated Columns Cameron Blashka | Entrinsik Inc. | September 12, 2018
Overview • String Manipulation • Concatenation • Substrings • MultiValue and Arrays • Searching for Specific Values • Associated Values • Dates • Formatting • Comparison • Time Between
String Methods • concat() • substr() • toUpperCase() • toLowerCase() • trim() • indexOf()
String Manipulation – Concatenation First Name + Last Name firstName + “ “ + lastName
String Manipulation - Substrings • First three characters + class description sectionCode.substr(0,3)+":"+cOURSE_assoc_crsTitle
String Manipulation - indexOf • Creating a Username var firstInitial = firstName.substr(0,1); var firstInitialLower = firstInitial.toLowerCase(); var lastLower = lastName.toLowerCase(); var lastSpace = lastLower.indexOf(" "); if(lastSpace > -1){ firstInitialLower+ lastLower.substr(0,lastSpace) } else{ firstInitialLower+lastLower; }
MultiValues and Arrays If a Specific Value Exists Lowest Value Highest Value var arr = fieldAlias; var highest = arr[0]; for(i=1;i<arr.length;i++){ if(arr[i] > highest){ highest = arr[i]; } } highest; var arr = fieldAlias; var lowest = arr[0]; for(i=1;i<arr.length;i++){ if(arr[i] < lowest){ lowest = arr[i]; } } lowest; var arr = fieldAlias; if(arr.indexOf(“value”)>-1){ “Value exists”; } else{ “Value does not exist”; }
MultiValues and Arrays • Associated Values
Date Formatting • Year - date.getYear()+1900 • Month - date.getMonth()+1 • Date - date.getDate() var sdf = new java.text.SimpleDateFormat(“MM-dd-yy”) sdf.format(date)
Any Questions? Thanks!
Further Reading • String Methods https://www.w3schools.com/js/js_string_methods.asp • Array Methods https://www.w3schools.com/js/js_array_methods.asp • Date Methods https://www.w3schools.com/js/js_date_methods.asp • Informer 4 Help Center – Calculated Columns https://entrinsikincraleigh.zendesk.com/hc/en-us/sections/200412537-Calculated-Columns