I have made a few posts on the forum regarding my  feature request for 
a command
"What table Does set belong"

I had an "AH HA!" type moment after my last post.

rather then the code that Jermey posted here, and similar code Jeorg 
posted on the forum. Both of which looped over all tables attempting to 
find a situation where unioning an unknown set and a known set (created 
in the loop) did NOT create an error. I posted some pseudo code on how 
to go about getting set information for ourselves.

It was while writing the pseudo code that it occurred to me it should 
not be too hard to write code to track sets so I CAN get validation 
information about wether a set exists or if 2 sets are from the same 
table etc.

I will in the next couple of days post either source, or a component 
(v13 - should be convertible to any newer version), probably to 
4DToday.com


however here is the outline of that code base (if interested let me 
know):

//basic functionality - adds set name and pointer to table to IP arrays
- utl_sets_Create_Set (->table;"Setname") -> errors if any (text)
- utl_sets_Create_Empty_Set (->table;"Setname") -> errors if any (text)
- utl_sets_Clear_Set ("Setname1" {;"Setname2";..."SetnameN"})
  (clears all set names passed - removes from IP arrays if they are 
found)

//New functionality - things we could NOT do before, 
//because we can lookup the set name or table pointer
//REQUIRES sets created by one of the above methods
- utl_sets_On_Same_Table ("Setname1";"Setname2") -> boolean are the 
sets from same table
- utl_sets_Does_Set_Exist  ("Setname1" {;"Setname2";..."SetnameN"}) -> 
boolean (all) set(s) exist
- utl_sets_What_Table ("Setname") -> pointer to table (or Nil)
- utl_sets_What_Sets (->Table1;->Error_text) -> list of sets found for 
table

// possible inclusions
- utl_sets_Union ("Setname1";"Setname2" {;"clear 2nd"}) - unions 2 sets 
to first, possibly clears 2nd
- utl_sets_Difference ("Setname1";"Setname2" {;"clear 2nd"}) - 
differences 2 sets to first, possibly clears 2nd
- utl_Intersection ("Setname1";"Setname2" {;"clear 2nd"}) - intersects 
2 sets to first, possibly clears 2nd
- utl_sets_Use_and_Clear ("Setname") - uses the set, then clears it
- utl_sets_Next_in_Set ("Setname) -> errors if any (text) - moves 
current record to the next record in set
  (useful for iterating over a set)

retro fitting should not be too hard.
a find and replace in Design of:
- "Create set(" with "utl_sets_Create_Set(->"
- "Create Empty set(" with "utl_sets_Create_Empty_Set(->"
- "Clear Set(" with "utl_sets_Clear_Set("

should get you started  :)


---------------
Gas is for washing parts
Alcohol is for drinkin'
Nitromethane is for racing 
**********************************************************************
4D Internet Users Group (4D iNUG)
FAQ:  http://lists.4d.com/faqnug.html
Archive:  http://lists.4d.com/archives.html
Options: http://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:[email protected]
**********************************************************************

Reply via email to