Solved

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

Posted on 2013-02-04
4
1,029 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 25

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 25

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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

As tax season makes its return, so does the increase in cyber crime and tax refund phishing that comes with it
In earlier versions of Windows (XP and before), you could drag a database to the taskbar, where it would appear as a taskbar icon to open that database.  This article shows how to recreate this functionality in Windows 7 through 10.
Basics of query design. Shows you how to construct a simple query by adding tables, perform joins, defining output columns, perform sorting, and apply criteria.
With Microsoft Access, learn how to start a database in different ways and produce different start-up actions allowing you to use a single database to perform multiple tasks. Specify a start-up form through options: Specify an Autoexec macro: Us…

679 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