Jump to content
Server Maintenance This Week. ×

FM 12 adv ... Find with or


ron G

This topic is 3794 days old. Please don't post here. Open a new topic instead.

Recommended Posts

In the cobwebs of my mind, I seem to remember there is a 'trick' to getting FM to allow me to use OR in a find.  I just can't locate it on the forum or in my mind...

 

Here is the situation:

I have a membership application.

There is a Dues table which allows members to make donations.

These donations may be either a single donation or an excess paid over the dues required.  This works.

post-72145-0-76217200-1387752417_thumb.j

 (Note there is a Dues Year and a Donation Year.  These two fields record the year of the dues payment and /or the year of the separate donation.  This is the 'or' part of the problem)

 

I created this Donation Layout.  It initially shows ALL the donations regardless of Donation as part of Dues or a separate donation.  However, I need to allow the user to specify a START YEAR and END YEAR which will find in EITHER the Dues_MembershipYR or the DonationYR field the specified beginning and ending year fields.

 

post-72145-0-70198700-1387752625_thumb.j

 

I write a script:

post-72145-0-52860300-1387752493_thumb.j

 

I need to be able to search for:

ALL "Members"

Including:  "Active"

Constrained To:  DuesYr or DonationYr <=$$YrStartDate and

                            DuesYr or DonationYr >= $$YrEndDate.

 

It is the *OR* part of Perform Find that I don't grasp.

 

I hope I was clear in this.  Thanks for reading.

 

Ron

 

Link to comment
Share on other sites

In general, OR is performed using the New Record/Request command in a find. In your example, you can rearrange the sequence like this:

 

Active AND DuesYr ≥ $$YrStartDate AND DuesYr ≤ $$YrEndDate

 

OR

 

Active AND DonationYr ≥= $$YrStartDate AND DonationYr ≤ $$YrEndDate

 
So the script steps would be:
 
Enter Find Mode[]
Set Field[status; "Active"]
Set Field[DuesYr; "≥"& $$YrStartDate]
Set Field[DuesYr; "≤"& $$YrEndDate]
New Record/Request
Set Field[status; "Active"]
Set Field[DonationYr; "≥"& $$YrStartDate]
Set Field[DonationYr; "≤"& $$YrEndDate]
Perform Find[]
 
BTW, the Show All Records step in your script is superfluous.  Finds automatically search the entire table; they are not limited to the current found set.
Link to comment
Share on other sites

Thanks for the reply.

I have never used layouts and Enter Find Mode() in my finds.  They have all been directly script drive.

Am I correct in understanding that it is mandatory to use a layout and a new record to affect the 'OR' feature?

ie, there is no way to directly script an 'or'?

Link to comment
Share on other sites

Dec22

Here is the latest.

I modified the script to use Find Mode as below:

post-72145-0-86207300-1387770989_thumb.j

 

My initial idea was to use a separate layout devoted to just the find.  But in the interest of simplicity I opted for using the same layout as the report.  I Just go into Find Mode, fill the fields, add a new record, fill the fields, perform the find and go back to browse.

 

But, this is the result when I specify 2013 as the Start and 2013 as the End years.

 

Perplexing.  Can you tell me where I screwed up?

 

post-72145-0-97631500-1387770729_thumb.j

post-72145-0-41746000-1387770617_thumb.j

Link to comment
Share on other sites

Update:

I decided to work the problem from the simples, manual perspective.  So, I manually went into FIND mode and entered "Member" and 2013

 

post-72145-0-17715000-1387780244_thumb.j

 

I got this output...

 

post-72145-0-26976500-1387780260_thumb.j

 

And this was NOT asking the find to do an OR.  It was just Members and Dues Year=2013.

 

What am I missing?

 

Thanks for your help.

 

Ron

Link to comment
Share on other sites

If you simulate the steps of a manual find in your script (o.e. use the Enter Find Mode / Set Field / Perform Find { New Record …} sequence), make sure that Enter Find Mode and Perform Find do not use the “Restore’ option, or your Set Field search criteria will be disregarded when you perform the search, and the criteria stored in the Perform Find step are used instead.

Link to comment
Share on other sites

In my script, I do not see a 'Restore' option.  What is it and where do I find it?  (Sorry to be so dense but I have always been able to script my finds.... until now...

 

post-72145-0-19328800-1387826858_thumb.j

 

The picture above shows the last "Constrain" and it's contents.  It sure seems like this should work... but it doesn't...

 

PS.  I tried using the Set field with Find and it works when I use 2013 for example.  However, my Year fields are held in global variables and I was unable to use them with Set Field....

 

Ideas?

 

Thanks

 

RON

Link to comment
Share on other sites

In my script, I do not see a 'Restore' option.  What is it and where do I find it?  (Sorry to be so dense but I have always been able to script my finds.... until now...

 

Look harder - it's all over the place … It's an option you set at the Script window bottom when the respective step is selected.

 

Of course, in the pictured script, you are using stored options, and my suggestion applies (as stated) to the scenario where you use Enter Find Mode / Set Field / Perform Find, and the Perform Find step must not use the Restore option, because it's only user to trigger the find as defined by your Set Field steps. 

 

PS.  I tried using the Set field with Find and it works when I use 2013 for example.  However, my Year fields are held in global variables and I was unable to use them with Set Field....

 

Set Field ( myTable::myField ; my$$ ) ?

 

Why again are you using global variables?

Link to comment
Share on other sites

Look harder - it's all over the place … It's an option you set at the Script window bottom when the respective step is selected.

 

Of course, in the pictured script, you are using stored options, and my suggestion applies (as stated) to the scenario where you use Enter Find Mode / Set Field / Perform Find, and the Perform Find step must not use the Restore option, because it's only user to trigger the find as defined by your Set Field steps. 

 

 

Set Field ( myTable::myField ; my$$ ) ?

 

Why again are you using global variables?

Got it to work.  One thing I NEEDED to do was to concatenate the global date variables into a range ($$YRRange=$$YrStartDate&"..."&$YrEndDate)  This simplified things a lot.

Then I just changed my find to this;

post-72145-0-86981800-1387840319_thumb.j

 

Hope this helps others. 

 

Thanks for the reply.

Link to comment
Share on other sites

This topic is 3794 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.