Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×

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

Recommended Posts

Posted

I am running a simple Show Dialog to troubleshoot one of my scripts...

If I run this calculation:

"Case ("10/10/2011" ≤ Month(Get(CurrentDate))+1&"/"&10&"/"&Year(Get(CurrentDate));"True"; )"

I get "True"

If I run this calculation:

"Case ("9/2/2011" ≤ Month(Get(CurrentDate))+1&"/"&10&"/"&Year(Get(CurrentDate));"True"; )"

I get ""

How does that make sense? I even ran:

Month(Get(CurrentDate))+1&"/"&10&"/"&Year(Get(CurrentDate))

And got 9/10/2011

So I know that at least FM is seeing the date it should....

What am I missing here?!

Posted

So I know that at least FM is seeing the date it should....

No, it's not seeing a date at all. "9/2/2011" is a text string and the comparison:

"10/10/2011" ≤ "9/2/2011"

returns True because in alphabetical order 1 comes before 9.

Use the Date() function to calculate a date from individual components.

Posted

"Case ("10/10/2011" ≤ Month(Get(CurrentDate))+1&"/"&10&"/"&Year(Get(CurrentDate));"True"; )"

Sorry, but that won't work...

You are trying to compare between a string item ("10/10/2011" - it's a string because it is in between quotes) and a date item - the data types cannot be used for comparison.

First you must convert the string to a date type.

Try GetAsDate("10/10/2011')

Problem "cracked"??

Posted

Even with:

Case (GetAsDate(10/10/2011) ≤ Month(Get(CurrentDate))+1&"/"&10&"/"&Year(Get(CurrentDate));"True"; )

Still showing True...

I am only doing this test because the following seems to be acting reversed:

If[RecurringTransactions::RTNextDate ≤ Month(Get(CurrentDate))+1&"/"&10&"/"&Year(Get(CurrentDate))]

When RTNextDate = 9/2/2011 the Script doesn't fire, when it = 10/10/2011, it fires

P.s. - RTNextDate is a date field with a pop up Calendar, so I know it's a valid date...

Posted

You are trying to compare between a string item ("10/10/2011" - it's a string because it is in between quotes) and a date item

The right side of the equation is also a text string.

---

I recommend using the Date() function over GetAsDate() because it doesn't depend on the date format in use.

Posted

Yeah I thought about the right side after I had posted that reply...

And the Date function did the trick!

Just for posterity's sake, the working Calculation was:

If[RecurringTransactions::RTNextDate ≤ Date(Month(Get(CurrentDate))+1;10;Year(Get(CurrentDate)))]

Thank you for all your help!

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