Testing for inclusion in a collection

Results 1 to 2 of 2

Thread: Testing for inclusion in a collection

  1. #1
    Join Date
    Dec 1969

    Default Testing for inclusion in a collection

    Does anyone know if there is way to test if a particular object is in a collection. For instance, I have a database file which may or may not contain a specific field, and I would like to be able to write a routine that tests whether the field is present or not.<BR><BR>The only think I can think of to do (and I don&#039t like this method) is to use a for each loop, go through the collection (a record set in this example) and see if any of the field names matches the one that I&#039m looking for.<BR>There&#039s gotta be a better way.<BR><BR>Thanks,<BR>Doug

  2. #2
    Join Date
    Dec 1969

    Default RE: Testing for inclusion in a collection

    Are you making the correct distinction between a *FIELD* and the *CONTENTS OF A FIELD in a particular record*??<BR><BR>For a FIELD to exist in a DB means simply that it is named in the schema. That is, if you do a list of field NAMES, there it is. <BR><BR>For particular *field contents* is a completely different question.<BR><BR>So which do you mean?<BR><BR>If field *contents*, then you haven&#039t been reading messages here long, have you? The whole point of probably 50% or more of DB usage is to only select records that have field contents that match some particular value. <BR><BR>If field *names*, then for most DB&#039s you can do OpenSchema and read the names from the resultant recordset just as if the schema was actually data. (It&#039s kind of a trick, but from an OO perspective it makes sense: You are just reading the "metadata" of the table.)<BR><BR>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts