EXISTS ( #getRecordsSQL(tablename=rfields[i].Relation["join-table"],advsql=subdatum.subadvsql)# ) // Loop over all root elements in XML for (i=1; i lte ArrayLen(arrTables);i=i+1) { // If element is a table and has a name, add it to the data if ( arrTables[i].XmlName eq "table" AND StructKeyExists(arrTables[i].XmlAttributes,"name") ) { //temp variable to reference this table thisTable = arrTables[i]; //table name thisTableName = thisTable.XmlAttributes["name"]; // Only add to struct if table doesn't exist or if cols should be altered if ( thisTableName EQ arguments.tablename ) { //Add to array of tables to add/alter fields = ""; // Loop through fields in table for (j=1; j lte ArrayLen(thisTable.XmlChildren);j=j+1) { // If this xml tag is a field if ( thisTable.XmlChildren[j].XmlName eq "field" OR thisTable.XmlChildren[j].XmlName eq "column" ) { thisField = thisTable.XmlChildren[j].XmlAttributes; tmpStruct = StructNew(); //If "name" attribute exists, but "ColumnName" att doesn't use name as ColumnName if ( StructKeyExists(thisField,"name") AND NOT StructKeyExists(thisField,"ColumnName") ) { thisField["ColumnName"] = thisField["name"]; } //Set ColumnName tmpStruct["ColumnName"] = thisField["ColumnName"]; //If "cfsqltype" attribute exists, but "CF_DataType" att doesn't use name as CF_DataType if ( StructKeyExists(thisField,"cfsqltype") AND NOT StructKeyExists(thisField,"CF_DataType") ) { thisField["CF_DataType"] = thisField["cfsqltype"]; } //Set CF_DataType if ( StructKeyExists(thisField,"CF_DataType") ) { tmpStruct["CF_DataType"] = thisField["CF_DataType"]; } //Set PrimaryKey (defaults to false) if ( StructKeyExists(thisField,"PrimaryKey") AND isBoolean(thisField["PrimaryKey"]) AND thisField["PrimaryKey"] ) { tmpStruct["PrimaryKey"] = true; } else { tmpStruct["PrimaryKey"] = false; } //Set AllowNulls (defaults to true) if ( StructKeyExists(thisField,"AllowNulls") AND isBoolean(thisField["AllowNulls"]) AND NOT thisField["AllowNulls"] ) { tmpStruct["AllowNulls"] = false; } else { tmpStruct["AllowNulls"] = true; } //Set length (if it exists and isnumeric) if ( StructKeyExists(thisField,"Length") AND isNumeric(thisField["Length"]) AND NOT tmpStruct["CF_DataType"] eq "CF_SQL_LONGVARCHAR" ) { tmpStruct["Length"] = Val(thisField["Length"]); } else { tmpStruct["Length"] = 0; } //Set increment (if exists and true) if ( StructKeyExists(thisField,"Increment") AND isBoolean(thisField["Increment"]) AND thisField["Increment"] ) { tmpStruct["Increment"] = true; } else { tmpStruct["Increment"] = false; } //Set precision (if exists and true) if ( StructKeyExists(thisField,"Precision") AND isNumeric(thisField["Precision"]) ) { tmpStruct["Precision"] = Val(thisField["Precision"]); } else { tmpStruct["Precision"] = ""; } //Set scale (if exists and true) if ( StructKeyExists(thisField,"Scale") AND isNumeric(thisField["Scale"]) ) { tmpStruct["Scale"] = Val(thisField["Scale"]); } else { tmpStruct["Scale"] = ""; } //Set default (if exists) if ( StructKeyExists(thisField,"Default") AND Len(thisField["Default"]) ) { tmpStruct["Default"] = makeDefaultValue(thisField["Default"],tmpStruct["CF_DataType"]); //} else { // tmpStruct["Default"] = ""; } //Set Special (if exists) if ( StructKeyExists(thisField,"Special") ) { tmpStruct["Special"] = Trim(thisField["Special"]); //Sorter or DeletionMark should default to zero if ( NOT StructKeyExists(tmpStruct,"Default") ) { if ( tmpStruct["Special"] EQ "Sorter" OR tmpStruct["Special"] EQ "DeletionMark" ) { tmpStruct["Default"] = 0; } } } else { tmpStruct["Special"] = ""; } //Set relation (if exists) if ( ArrayLen(thisTable.XmlChildren[j].XmlChildren) eq 1 AND thisTable.XmlChildren[j].XmlChildren[1].XmlName eq "relation" ) { tmpStruct["Relation"] = expandRelationStruct(thisTable.XmlChildren[j].XmlChildren[1].XmlAttributes); } //Copy data set in temporary structure to result storage if ( NOT ListFindNoCase(fields, tmpStruct["ColumnName"]) ) { fields = ListAppend(fields,tmpStruct["ColumnName"]); ArrayAppend(aFields, StructNew()); aFields[ArrayLen(aFields)] = Duplicate(tmpStruct); } }// /If this xml tag is a field }// /Loop through fields in table }// /Only add to struct if table doesn't exist or if cols should be altered }// /If element is a table and has a name, add it to the data }// /Loop over all root elements in XML , #escape(fields[i].ColumnName)# FROM #arguments.tablealias# WHERE 1 = 1 ---> #Trim(PreserveSingleQuotes(arguments.sql))# #Trim(PreserveSingleQuotes(temp))#10#CreateODBCDateTime(aSQL[i].value)##Val(aSQL[i].value)# /** * Removes rows from a query. * Added var col = ""; * No longer using Evaluate. Function is MUCH smaller now. * * @param Query Query to be modified * @param Rows Either a number or a list of numbers * @return This function returns a query. * @author Raymond Camden (ray@camdenfamily.com) * @version 2, October 11, 2001 */ function QueryDeleteRows(Query,Rows) { var tmp = QueryNew(Query.ColumnList); var i = 1; var x = 1; for(i=1;i lte Query.recordCount; i=i+1) { if(not ListFind(Rows,i)) { QueryAddRow(tmp,1); for(x=1;x lte ListLen(tmp.ColumnList);x=x+1) { QuerySetCell(tmp, ListGetAt(tmp.ColumnList,x), query[ListGetAt(tmp.ColumnList,x)][i]); } } } return tmp; }