Solved

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

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

Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

Question has a verified solution.

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

This article is a continuation or rather an extension from Cascading Combos (http://www.experts-exchange.com/A_5949.html) and builds on examples developed in detail there. It should be understandable alone, but I recommend reading the previous artic…
A simple tool to export all objects of two Access files as text and compare it with Meld, a free diff tool.
Familiarize people with the process of utilizing SQL Server functions from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Ac…
Learn how to number pages in an Access report over each group. Activate two pass printing by referencing the pages property: Add code to the Page Footers OnFormat event to capture the pages as there occur for each group. Use the pages property to …

856 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