Solved

Moving From Access 2010 to Filemaker Pro 12 Convert Query To Script

Posted on 2013-02-04
4
1,013 Views
Last Modified: 2013-02-06
I am currently using access 2010 and have a Query that i need to replicate in Filemaker Pro 12, Basically i need to be able to specify a start date and end date and have filemaker search by different fields to return the correct results.

Current Access Script is as follows:

SELECT [Former Hillcrest Staff].[Employee ID], [Former Hillcrest Staff].[First Name], [Former Hillcrest Staff].[Last Name], [Former Hillcrest Staff].[Hire Date], [Former Hillcrest Staff].[Termination Date], [Former Hillcrest Staff].Address, [Former Hillcrest Staff].City, [Former Hillcrest Staff].State, [Former Hillcrest Staff].Zip, [Former Hillcrest Staff].[Cell Phone #], [Former Hillcrest Staff].[Birth Date], [Former Hillcrest Staff].[Job Code], [Former Hillcrest Staff].[License Type], [Former Hillcrest Staff].[License Expiration], [Former Hillcrest Staff].[License #]
FROM [Former Hillcrest Staff]

WHERE ((([Former Hillcrest Staff].[Hire Date])<=[Start Date:]) AND (([Former Hillcrest Staff].[Termination Date])>=[End Date:])) OR ((([Former Hillcrest Staff].[Hire Date]) Between [Start Date:] And [End Date:]) OR (([Former Hillcrest Staff].[Termination Date]) Between [Start Date:] And [End Date:]))

thanks in advance
0
Comment
Question by:westereo86
  • 2
4 Comments
 
LVL 5

Assisted Solution

by:Peter Harris
Peter Harris earned 250 total points
ID: 38853629
One easy way to achieve this is to create a Calculation field as part of the same table.

The Calculation should be set to return a number.

The calculation would match the WHERE clause in your query:
(((HireDate <= StartDate) ... etc.

However do not use 'Between' eg. 'TerminationDate Between StartDate And EndDate'
should instead be:
(TerminationDate >= StartDate) and (TerminationDate <= EndDate)

After creating the field you can search for 1 (true) to find the required records.

If you want this in a script then the script would have a goto layout step (the layout would have all the required fields on it, then find the matching records.
0
 
LVL 24

Expert Comment

by:Will Loving
ID: 38858276
cogitive is correct that the simplest way to manage this Find is to create a calculation field, however, it's not necessary to have a special layout with required fields on it, at least not since at least FileMaker Pro 7 and possibly earlier. A Find Records [ ] script step with the singe Find Request for the calc field is all that's necessary unless you want post record processing like going to a list view if there are multiple records or a Form view if there is only one.
0
 

Author Comment

by:westereo86
ID: 38859667
Thanks for the information, could someone clarify in more detail how to write/setup the calculation field?
0
 
LVL 24

Accepted Solution

by:
Will Loving earned 250 total points
ID: 38860261
Case(
   ( ( HireDate = StartDate ) and (TerminationDate = EndDate) )  or
   ( ( HireDate = StartDate ) and (HireDate = EndDate) )  or
   ( ( TerminationDate = StartDate ) and (TerminationDate = EndDate) )  
; 1 )

I'm not sure I counted all the parens correctly so you may need to adjust this but the above calculation finds three different combinations of circumstances:

1) Any instance where the HireDate is more recent than the StartDate and the Termination Date is more recent that the EndDate

2) The HireDate is between the  StartDate and EndDate

3) TerminationDate is between the StartDate and EndDate

WHERE ((([Former Hillcrest Staff].[Hire Date])<=[Start Date:]) AND (([Former Hillcrest Staff].[Termination Date])>=[End Date:])) OR ((([Former Hillcrest Staff].[Hire Date]) Between [Start Date:] And [End Date:]) OR (([Former Hillcrest Staff].[Termination Date]) Between [Start Date:] And [End Date:]))
0

Featured Post

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

Regardless of which version on MS Access you are using, one of the harder data-entry forms to create is one where most data from previous entries needs to be appended to new records, especially when there are numerous fields and records involved.  W…
I see at least one EE question a week that pertains to using temporary tables in MS Access.  But surprisingly, I was unable to find a single article devoted solely to this topic. I don’t intend to describe all of the uses of temporary tables in t…
Using Microsoft Access, learn some simple rules for how to construct tables in a relational database. Split up all multi-value fields into single values: Split up fields that belong to other things into separate tables: Make sure that all record…
In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …

708 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now