Jump to content
Salesforce and other SMB Solutions are coming soon. ×

Date range search, button click


lnopadol

Recommended Posts

I have been using a few web based program and very impress with their interface design and ease of use. One function which I came across and would like to emulate in my FM database.

 

I want to be able to search the Invoice due within this week, by simply providing a button for my admin to click each morning and see exactly which one to follow up. And so, a few more buttons for next 2 week, 4 weeks etc.

 

I tried several ways, but seemed to fail miserably.

 

The database which I have worked on contains field like: invoice date, which signify the issued date. So the script needs to be able to add may be 30 days of credit term and the notify the log in admin that "this week these invoices are due."

 

Thank you so much.

Link to comment
Share on other sites

Are you saying you want to do a scripted find for all records where Invoice Date + 30 days is less than or equal to the end of this week? Or where Invoice Days + Days of Credit Term (which may be 30 or may be something else) is less than or equal to the end of this week?

 

First you need to snag "end of this week"; there are functions like DayOfWeek and DayName which can be used in conjunction with Get(CurrentDate) to figure out whether today is Monday, Tuesday, etc, and that tells you how many days to add to Get(CurrentDate) to get Friday or whenever you consider the end of week to be.

 

Let's say you get that set up and, within your script, set a variable $EndOfWeek to the date that represents end of this week to you.

 

then you just:

 

 

Enter Find Mode []

Set Field [invoice Date, ≤ $EndOfWeek]

Set Error Capture [On]

Perform Find

Link to comment
Share on other sites

Thank you very much.

First, what I want to do is the 2nd option that you have stated, invoice date + payment term(can be varied).

 

Now when you get to the "end of week" thing, I got pretty lost. I have never tried them before.

 

Without that set up, I have tried different alternative around that. Still did not seem to work.

Link to comment
Share on other sites

Let's say you consider Friday to be the end of the week.

 

Set Variable [$EndOfWeek, Let (today = Get(CurrentDate); today + Case ( dayname (today) = "Friday", 0; dayname (today) = "Thursday", 1; dayname (today) = "Wednesday", 2; dayname (today) = "Tuesday", 3; dayname (today) = "Monday", 4; dayname (today) = "Sunday", 5; dayname (today) = "Saturday", 6) )]

 

Enter Find Mode []

Set Field [invoice Date, ≤ $EndOfWeek]

Set Error Capture [On]

Perform Find

Link to comment
Share on other sites

I'm really sorry, I'm really trying to write up this thing according to your recommendation. But where exactly do I set this variable. Using ScriptMaker, Set Variable command? I know it sounds really basic, but I really am trying.

 

"

Set Variable [$EndOfWeek, Let (today = Get(CurrentDate); today + Case ( dayname (today) = "Friday", 0; dayname (today) = "Thursday", 1; dayname (today) = "Wednesday", 2; dayname (today) = "Tuesday", 3; dayname (today) = "Monday", 4; dayname (today) = "Sunday", 5; dayname (today) = "Saturday", 6) )]

"

 

 

Enter Find Mode []

Set Field [invoice Date, ≤ $EndOfWeek]

Set Error Capture [On]

Perform Find

Link to comment
Share on other sites

Yes, you use the Set Variable command.

 

Are you new to scripting? If someone says do this:

 

Any Command [blahBlah, "Yadda" & Yadda(Yadda) ]

 

do you understand that the comma means the separation between "this is the field or variable or other target" and "this is what you set it to" ?

Link to comment
Share on other sites

I'm so new to the scripting idea. I have been putting together a handful of useful database with the lease necessary of scripting. When I do use them, it was super simple. So, the one you post to me was totally something that I need to learn from scratch.

Link to comment
Share on other sites

well, Welcome to the ScriptMaker!

 

The scripting in FileMaker is where you really learn how to make it behave the way you want it to.

Link to comment
Share on other sites



×
×
  • Create New...

Important Information

Terms of Use