#col#="#aFields[ii][col]#" #col#="#aFields[ii][col]#" />>
#col#="#XmlFormat(aFields[ii].relation[col])#" />
#att#="#XmlFormat(aFields[ii].relation.filters[jj][att])#" />
#XmlAsString(variables.xDef.tables.XmlChildren[ii])#
function makeCompName(str) {
var result = "";
var find = FindNoCase(" ",result);
var word = "";
var ii = 0;
/* Turn all special characters into spaces */
str = ReReplaceNoCase(str,"[^a-z0-9]"," ","ALL");
/* Remove duplicate spaces */
while ( find GT 0 ) {
str = ReplaceNoCase(str," "," ","ALL");
find = FindNoCase(" ",str);
}
/* Proper case words and remove spaces */
for ( ii=1; ii LTE ListLen(str," "); ii=ii+1 ) {
word = ListGetAt(str,ii," ");
word = UCase(Left(word,1)) & LCase(Mid(word,2,Len(word)-1));
result = "#result##word#";
}
return result;
}
/**
* Tests passed value to see if it is a properly formatted U.S. zip code.
*
* @param str String to be checked. (Required)
* @return Returns a boolean.
* @author Jeff Guillaume (jeff@kazoomis.com)
* @version 1, May 8, 2002
*/
function IsZipUS(str) {
return REFind('^[[:digit:]]{5}(( |-)?[[:digit:]]{4})?$', str);
}
/**
* Creates a unique file name; used to prevent overwriting when moving or copying files from one location to another.
* v2, bug found with dots in path, bug found by joseph
*
* @param fullpath Full path to file. (Required)
* @return Returns a string.
* @author Marc Esher (marc.esher@cablespeed.com)
* @version 2, January 22, 2008
*/
function createUniqueFileName(fullPath){
var extension = "";
var thePath = "";
var newPath = arguments.fullPath;
var counter = 0;
if(listLen(fullPath,".") gte 2) extension = listLast(fullPath,".");
thePath = listDeleteAt(fullPath,listLen(fullPath,"."),".");
while(fileExists(newPath)){
counter = counter+1;
newPath = thePath & "_" & counter & "." & extension;
}
return newPath;
}
/**
* Makes a row of a query into a structure.
*
* @param query The query to work with.
* @param row Row number to check. Defaults to row 1.
* @return Returns a structure.
* @author Nathan Dintenfass (nathan@changemedia.com)
* @version 1, December 11, 2001
*/
function queryRowToStruct(query){
//by default, do this to the first row of the query
var row = 1;
//a var for looping
var ii = 1;
//the cols to loop over
var cols = listToArray(query.columnList);
//the struct to return
var stReturn = structnew();
//if there is a second argument, use that for the row number
if(arrayLen(arguments) GT 1)
row = arguments[2];
//loop over the cols and build the struct from the query row
for(ii = 1; ii lte arraylen(cols); ii = ii + 1){
stReturn[cols[ii]] = query[cols[ii]][row];
}
//return the struct
return stReturn;
}