AnsweredAssumed Answered

Multiple user defined find script

Question asked by Stu412 on Aug 6, 2015
Latest reply on Aug 6, 2015 by Stu412

Title

Multiple user defined find script

Post

I have a script which I use to find and omit certain records in an On Layout Entry scenario and I wish to add to this so that a user can select the dates of the records to be returned.  I'm using global fields for the date selection and passing these through to the script find routine.

The problem I'm having is that if I search for all records with :

31/01/2014 

31/01/2013

31/01/2011 (Two thousand and eleven)

The routine, despite showing only three dates in debug, pulls through records for 2012 as well, which I don't want.

The script part is pretty simple and consists of two parts.  First part removes anything I don't want, the second part is to show the years I do want to see from what's remaining:

#Part 1

Enter Find Mode

New Record Request

Set Field (DataTable::Filter; "XXX") //Remove any records marked as "XXX"

Omit Record

Perform Find

#Part 2

Enter Find Mode

New record/request

Set field (DataTable::CustomerID; $CustomerID_FK)

Set field (DateTable::Date;$FirstGlobalDate)

New record/request

Set field (DataTable::CustomerID; $CustomerID_FK_)

Set field (DataTable::Date;$SecondGlobalDate)

.

etc for three more repetitions per global field

Constrain found set

Hope that's ok for people, I don't understand why it's ignoring the fact I don't want it to find 2012.

Thanks

Edit

Have just discovered that if any of the global date fields are empty, FM will return all years' data.

Anybody know of a simple way to disallow the find on a year if it's empty as that should solve this problem?

Thanks

Outcomes