Solved

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

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

Suggested Solutions

Title # Comments Views Activity
sql statement - 9 27
Access check if a table is open 4 43
Problem copying record details to a new record 5 9
Part 2 to aggregate query solved qtn 12 40
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…
As tax season makes its return, so does the increase in cyber crime and tax refund phishing that comes with it
What’s inside an Access Desktop Database. Will look at the basic interface, Navigation Pane (Database Container), Tables, Queries, Forms, Report, Macro’s, and VBA code.
In Microsoft Access, learn the trick to repeating sub-report headings at the top of each page. The problem with sub-reports and headings: Add a dummy group to the sub report using the expression =1: Set the “Repeat Section” property of the dummy…

823 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