Jump to content
Server Maintenance This Week. ×

How to find the most recent date in a search?


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

Recommended Posts

I have a script for eksport:

 

Go to layout ["Upload" (Upload)]

Perform Find [Restore]

Export records [No Dialog: ....]

 

The Find is defined as follows:

 

Action: Find Records

Criteria: Upload::Genre: [klassisk] AND  Upload ::Nyhedsbrev: [23/06/2014]

 

Before running the script I must manually edit the date. Isn't it possible to ask for "the most recent date"?

 

This date is alwaysimported from Excel. It's always monday in the week. If I run the script today (2014/07/05) the most recent date would be 2014/06/30.

Link to comment
Share on other sites

Consultant: I'm not sure what you mean. I guess the sentence "If I run the script today (2014/07/05) the most recent date would be 2014/06/30" can be confusing. It was meant as an imaginary example of the output I want. The reality is that I want to change my existing script:

 

Action: Find Records

Criteria: Upload::Genre: [klassisk] AND  Upload ::Nyhedsbrev: [23/06/2014]

 

Before running the script I must manually edit the date every monday. Isn't it possible to ask for "the most recent date"?

Link to comment
Share on other sites

Isn't it possible to ask for "the most recent date"?

 

No, it's not. When you perform a find, Filemaker looks at the data that's in the specified field and compares it to the specified criteria. It does not compare it to data from other fields or records.

 

What you can do is find out what's the most recent date first, then perform a find looking for this specific date. For example, you could show all records, unsort them, go to the last record and set a variable to the date of that record. Alternatively, if you know that "the most recent date" is always the date of the most recent Monday, you could calculate it from the current date. However, that raises the question of what is "the most recent Monday" when today is Monday: is it the date of today, or is it the Monday a week ago.

Link to comment
Share on other sites

I am an amateur with a capital A, but I strive to continue working on my own from the tips and advice I get here.

My solutions are always primitive and probably unnecessarily cumbersome, but as long as they work I happy.

in this case I I tried a solution with three columns in my database:

Newsletter

Current date

most recent

They are all formatted as date / YY / MM / DD

"Newsletter" is a look up field with data from another layout.
"Current date": Auto-Enter The calculated value "Get (Current Date) - 8"
"Most siste": Auto-Enter The calculated value "If (the newsletter> Current date, 01/01/2000, 01/01/2001)

The output in the "Most siste" field are shown as respektively 0001/01/01 0001/01/02. I can't figure out why.

Apart from the problem with the date format, the correct answer for the latest date should be 0001/01/01. Unfortunately, the result is 146 records, where the correct figure would be 86.

By changing the Auto-Enter from "Get (Current Date) - 8" to "Get (Current Date) - 6" the result appears just as desiredand when I further changes "Most recent" to "Text" and set the calculated value to "If (NEWSLETTER> Current date," x "," ")", then result is perfect.

Yes, Consultant, i guess you're having fun , but I came to something useful with your help :-)

Link to comment
Share on other sites

 i guess you're having fun

 

No, actually I am horrified. I have no idea what you're doing or why. Or why you're telling us all this. Is this in any way related to the question of how to find records with the most recent date, or are you just blogging?

Link to comment
Share on other sites

 

... but I came to something useful with your help :-)

 

Nope, you didn't.  You came up with a kludge which is breaking.  There are so many errors in your thinking that I cannot even begin to begin.  I sense that you believe we're all laughing at your newbie situation.  That is untrue; we all are new at some time and just because we know more about this business than you do, doesn't mean we think less of you for it.  

 

You have one of the best developers in this business at your fingertips to help you through your needs and he has explained enough for you to understand if you stop going on your own and LISTEN.  But until you truly care about doing it right instead of "but as long as they work I happy", you will fall flat time after time and never learn a thing except how to throw mud on the wall a bit better.  And you will create a twisted solution that runs like a dog and sinks like a stone.

 

So slow down, listen and set your mud techniques aside - after all, they don't work which is why you posted.  Example:  you are auto-entering the current date.  That will break tomorrow because it will not update.  Back up and re-read what he has asked, think it through, and answer his question which you have yet to answer.  This is the second time now that he has wanted to know (see post #2 as well):

 

 However, that raises the question of what is "the most recent Monday" when today is Monday: is it the date of today, or is it the Monday a week ago.

Link to comment
Share on other sites

LaRetta,

 

I really appreciate your frankness. When I write that I'm happy as long as it works, it's partly because my general requirements concerning my responsibilities is modest, but partly also because I am very humbled by the expertise in this forum. Yes, it would be tempting to slice "I do not understand a ******* thing of what you write. Please fix it for me."

Maybe I'm too modest?

Link to comment
Share on other sites

Please attach a file so that we can be on the same page. If you do not know how to do this, then follow the steps found at this link ATTACH A FILE

 

 

Often a file will cut shot the communication problems.

 

Lee

Edited by Ocean West
Link to comment
Share on other sites

:backtotopic:

 

I have hidden the posts that are irrelevant to this thread. Please be as precise as possible to explain what you need to accomplish - If you are providing assistance please be patient with each other!

Link to comment
Share on other sites

This topic is 3581 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.