?
Solved

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

Posted on 2013-02-04
4
Medium Priority
?
1,040 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 5

Assisted Solution

by:Peter Harris
Peter Harris earned 1000 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 1000 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

Free learning courses: Active Directory Deep Dive

Get a firm grasp on your IT environment when you learn Active Directory best practices with Veeam! Watch all, or choose any amount, of this three-part webinar series to improve your skills. From the basics to virtualization and backup, we got you covered.

Question has a verified solution.

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

It’s the first day of March, the weather is starting to warm up and the excitement of the upcoming St. Patrick’s Day holiday can be felt throughout the world.
This article describes two methods for creating a combo box that can be used to add new items to the row source -- one for simple lookup tables, and one for a more complex row source where the new item needs data for several fields.
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…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …
Suggested Courses

770 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