First I have to get some more logical errors out of my code. The below is 
cleaned up.



$numInSet:=Records in set($setName)

If ($numInSet>0)
          // two possibilities
          // 1. set does not exist
          // 2. set exists but has no records
          // logic: The documentation says: // ADD TO SET ( {aTable ;} set ) … 
ADD TO SET adds the current record of aTable to set. The set must already 
exist; if it does not, an error occurs.
          // if the set does not exist, I will get an error.
          // if it does exist then I will NOT get an error but it is safe 
because I will not have changed the state of anything since adding zero records 
to an existing set does nothing.
        fErrorHappened:=False  // this is a process variable that is created at 
        ON ERR CALL("ErrorIgnore")  // ErrorIgnore is a method that sets 
fErrorHappened to true
        ADD TO SET($setName)  // if the set does not exist, this will throw an 
error. This particular "Set" command is sensitive as to whether the set exists
        ON ERR CALL("")
        If (fErrorHappened)
        End if 
End if 


> On Jul 17, 2017, at 1:07 AM, Julio Carneiro via 4D_Tech 
> <> wrote:
> Just out of curiosity, what happens if there is no current record to add to 
> the set?
> - do you get an error, which might only indicate no record exists to add to 
> an existing set?
> - nothing happens, even if set does not exist?

I am doing the testing in a simple interpreted environment. No server etc.

If there is an empty current selection then the code (interpreted) correctly 
determines whether the set exists or does not exist.

If there is a multi-record current selection but the current record does not 
exist than the code (interpreted) correctly determines whether the set exists 
or does not exist.
4D Internet Users Group (4D iNUG)

Reply via email to