Script Error: TypeError: underfined is not a function
Hi, we have had a random error crop up and a little baffled. The following code has worked for years in Podio in other workspaces, however not consistently anymore in a newly created workspace? We did have some success in the Modify Template window by refreshing the browser on a windows machine, re-saved the template and the code worked as expected...however trying the same on a Mac and now not working?? I expect that we are missing something or could be a bug? Any help would be appreciated.
// Declare an array to hold all the scope text
var scopeText = new Array(11)
scopeText[0] = 'No change'
// Assign the scope text to the array
scopeText[1] = 'Treatment: \nF1 - 2.1m metal fence (0.48 BMT). \nScope of Work: \nConstruct a new 2.1m high boundary fence using profiled sheet metal with minimum base metal thickness (BMT) = 0.48mm. The fence colour must chosen in consultation with the property owner. The extent of the fence must be in accordance with the acoustic engineer requirements outlined in the Boundary Fence Treatment diagram. The fence must not have any gaps at the base to allow sound flanking.'
scopeText[2] = 'Treatment: \nF2 - 2.4m metal fence (0.6 BMT). \nScope of Work: \nConstruct a new 2.4m high boundary fence using profiled sheet metal with minimum base metal thickness (BMT) = 0.6mm. The fence colour must chosen in consultation with the property owner. The extent of the fence must be in accordance with the acoustic engineer requirements outlined in the Boundary Fence Treatment diagram. The fence must not have any gaps at the base to allow sound flanking.'
scopeText[3] = 'Treatment: \nF3 - 2.7m metal fence (0.8 BMT). \nScope of Work: \nConstruct a new 2.7m high boundary fence using profiled sheet metal with minimum base metal thickness (BMT) = 0.8mm. The fence colour must chosen in consultation with the property owner. The extent of the fence must be in accordance with the acoustic engineer requirements outlined in the Boundary Fence Treatment diagram. The fence must not have any gaps at the base to allow sound flanking.'
scopeText[4] = 'Treatment: \nF4 - 2.1m composite panel fence. \nScope of Work: \nConstruct a new 2.1m high boundary fence using composite panels with a minimum Rw25 rating. The fence colour must chosen in consultation with the property owner. The extent of the fence must be in accordance with the acoustic engineer requirements outlined in the Boundary Fence Treatment diagram. The fence must not have any gaps at the base to allow sound flanking.'
scopeText[5] = 'Treatment: \nF5 - 2.4m composite panel fence. \nScope of Work: \nConstruct a new 2.4m high boundary fence using composite panels with a minimum Rw25 rating. The fence colour must chosen in consultation with the property owner. The extent of the fence must be in accordance with the acoustic engineer requirements outlined in the Boundary Fence Treatment diagram. The fence must not have any gaps at the base to allow sound flanking.'
scopeText[6] = 'Treatment: \nF6 - 2.7m composite panel fence. \nScope of Work: \nConstruct a new 2.7m high boundary fence using composite panels with a minimum Rw28 rating. The fence colour must chosen in consultation with the property owner. The extent of the fence must be in accordance with the acoustic engineer requirements outlined in the Boundary Fence Treatment diagram. The fence must not have any gaps at the base to allow sound flanking.'
scopeText[7] = 'Treatment: \nF7 - Driveway access gate required - MANUAL OPEN. \nScope of Work: \nInstall a new manually operated driveway access gate to match the height and material of the existing or newly installed fence.'
scopeText[8] = 'Treatment: \nF8 - Driveway access gate required - AUTO OPEN. \nScope of Work: \nInstall a new remote controlled, motorised, driveway access gate to match the height and material of the existing or newly installed fence.'
scopeText[9] = 'Treatment: \nF9 - Pedestrian access gate required. \nScope of Work: \nInstall a new pedestrian access gate to match the height and material of the existing or newly installed fence.'
scopeText[10] = 'Treatment: \nF10 - Custom Scope. \nScope of Work: \n' + @Notes
if (@Mitigation - Most exposed boundary =="No change") {null} else {
// create patterns to match scope codes
var Pattern = new RegExp("[0-9]{1,2}","")
var Pattern2 = new RegExp("F[0-9]{1,2}.*","")
// get the scope code, ie F1
scopeCode = @Mitigation - Most exposed boundary .match(Pattern)
// substitute for scope text
x = "\n"+ @Mitigation - Most exposed boundary .replace(Pattern2,scopeText[scopeCode]) + "\n"}
Please sign in to leave a comment.
Comments
0 comments