AnsweredAssumed Answered

Constrain Found Set script step fails

Question asked by JohnWolcott on Dec 14, 2010
Latest reply on Dec 15, 2010 by JohnWolcott


Constrain Found Set script step fails


I have a simple table with Date, Date_Type, and Type fields.  (Actually there are a few more, like a primary key, a secondary key, a date created field and a date modified field, etc. lest you think I am a complete beginner.)  Date is a date field, the other 2 are text fields.  Date_Type has values "Projected" "Appointment" and "Actual".  Type has vaules "Phone" " Test" "Skin Check" and "Chart Review".  There are 3 buttons on the layout.  One button finds all records with Date_Type = "Projected" and omits those with Type = "Chart Review".  The other two buttons find either just the Type = "Phone" or Type = "Test" and Date_Type = projected.

I thought I could do this with one script using script parameters.  The button to find all types except "Chart Review" passes no script parameter.  The other two buttons pass either "Phone" or "Test".  The script below works for the first button, finding all records except "Chart Review" types.  But it fails when used for the other 2 buttons.  Instead, it finds all records.  If I omit the Constrain Found Set step, then the same script works for the other two buttons.  It seems that if there are no records to constrain (omit) the script finds all 4 types with Date_Type = "Projected".  It isn't a big deal having 2 scripts doing 3 things, but I think I could have 1 script do all 3 things.

In a previous post, PhilModJunk showed a user how to add a new request to omit certain records and stated that it could be used in a script, but I don't know how to add a new request in a script except with the Constrain/Expand Found Set steps.

Enter Find Mode []

SetField [Dates:Date_Type; "Projected']

SetField [Dates:Type; Get ( ScriptParameter )

Constrain Found Set [Restore]

Perform Find []


The Criteria in the "Specify Find Request" part of the Constrain Found Set step has

Find Records     Dates::Date_Type: [Projected]

Omit Records    Dates:Type: [Chart Review]