Jump to content

Finding records between dates and according to a criteria selected in a dropdown


This topic is 1854 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Hi.
I have a database that lists grant applications.
I need for my user to be able to view the records in a number of ways according to certain criteria for analysis purposes. These records are displayed in a List layout.

I need to be able to:

1) see only records where the submission dates are between x and y

then

2)  filter these records according to what is selected in  2 dropdowns - Outcome and Status. The Outcome field dropdown value list is : <blank>, granted, unsuccessful, unknown. The Status field is  dropdown value list is: <blank>,submitted, in progress, finalised. The <blank> is where that dropdown criteria are not required.

Ideally, I'd like to be able to set the dates, select from the dropdowns and perform the find, but happy to do it in 2 steps if necessary.

I've tried several things from solutions found searching the internet, but nothing seems to work and I'm getting increasingly frustrated with it. I'm not a coder and anyone good enough to help me out here needs to be aware of this. While I've been using FM on and off for a number of years, I'm by no means an expert or even near it.

Thank  you in advance for any guidance with this. You guys have helped me out in the past.

Link to comment
Share on other sites

I suggest you start by defining 4 global fields to hold your criteria -  gFromDate, gToDate, gOutcome and gStatus - and place them in the header part of your layout, next to a Find button. Make the button run a script that does:

Enter Find Mode []
Set Field [ YourTable::SubmissionDate ; "≥" & YourTable::gFromDate ]
Set Field [ YourTable::SubmissionDate ; "≤" & YourTable::gToDate ]
Set Field [ YourTable::Outcome ; YourTable::Outcome ]
Set Field [ YourTable::Status ; YourTable::gStatus ]
Perform Find []

That's a rough sketch, there are many variations and embellishments possible.

Link to comment
Share on other sites

2 hours ago, comment said:

 



Set Field [ YourTable::SubmissionDate ; "≥" & YourTable::gFromDate ]
Set Field [ YourTable::SubmissionDate ; "≤" & YourTable::gToDate ]

 

That wouldn't work. The second set field would overwrite the first set field.

Set Field [ table::SubmissionDate; Table::gFromDate & "..." & Table::gToDate ]

would work.

 

Link to comment
Share on other sites

Hi. Thank you for the help so far :)

I already had the globals.

I started to create the script but when I added the following into the Calculated Result for Set Field, I got the message saying an operator was expected:

Grants::Date Submitted;Grants::gSubmittedFromDate &"..."& Grants::gSubmittedToDate

Any thoughts?

 

Link to comment
Share on other sites

The Set Field step has two parts.

Grants::Date Submitted is the field you want to set; you select it when specifying the target field.

When specifying the calculated result, enter ONLY this into the calculation window:

Grants::gSubmittedFromDate &"..."& Grants::gSubmittedToDate

 

Link to comment
Share on other sites

Thank you so very much for your help - as soon as you explained it I realised how obvious it was. I must have been so far down the rabbit hole that I could no longer see the obvious.

I was just going through the file in a final check and realised on my global summary layout, I still have an issue with a date thing.
I want to show the date of the first record entered and a date of the last record entered. I've done a Summary field for Min and one for Max but nothing shows up in the live view.

Any thoughts?

Screen Shot 2019-03-02 at 11.45.56 am.png

Screen Shot 2019-03-02 at 11.42.29 am.png

Edited by DreadDamsel
Link to comment
Share on other sites

Why not simply use gSubmittedFromDate and gSubmittedToDate? That is  the date range they've entered to search, if you showed them different dates, they might get confused, and think the system is doing something odd.

Link to comment
Share on other sites

This is a different purpose - it's simply displayed information, not entered. It's the date the first record is created and the most recent date a record has been created - this date is auto-filled on creation of a new record.

It displays on a different layout.

Link to comment
Share on other sites

This topic is 1854 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.