' TmpField.ave ' Creates a temporary field name for a VTab ' Arguments: theVTab = VTab ' thePrefix = String (prefix for field name) ' theSuffix = String (suffix for field name) ' Notes: ' If thePrefix = "", "xx" will be used ' It is up to the caller of the script to add the temporary field before ' calling the script again. Otherwise, the same value will be returned. theVTab = SELF.Get(0) thePrefix = SELF.Get(1) theSuffix = SELF.Get(2) if (thePrefix = "") then thePrefix = "xx" end if ((thePrefix.Count + theSuffix.Count) > 7) then MsgBox.Error("Too many characters in suffix and/or prefix.","TmpField") return nil end '**** get list of field names fl = List.Make for each f in theVTab.GetFields fl.Add(f.GetName.AsString) end w = 10 - (thePrefix.Count + theSuffix.Count) fs = String.MakeBuffer(w) fs = fs.Translate(" ","d") v = 0 Done = false while (Done.Not) v.SetFormat(fs) tmpFieldName = thePrefix + v.AsString + theSuffix if (fl.FindByValue(tmpFieldName) = -1) then done = true end v = v + 1 end return tmpFieldName