sykot Posted July 15, 2011 Posted July 15, 2011 Hello guy's I have a question. as you can see on the image the layouts shows the records of current year 2011. i have a script that allows me to go to the next year (script on the image), but if the layouts shows the current year i want to prevent that the scripts stops because there are no records at the moment of year 2012. I tried something but nothing helped, how can i do this? Kind regards, Serhat
Fitch Posted July 15, 2011 Posted July 15, 2011 In your first script line, you're comparing a date to a year.
sykot Posted July 15, 2011 Author Posted July 15, 2011 Thats true... i tried something but the original code is this
comment Posted July 15, 2011 Posted July 15, 2011 Try something like: If [ Year ( YourTable::YourDateField ) < Year ( Get (CurrentDate) ) ] # DO THE THING ... Else Beep End If
sykot Posted July 16, 2011 Author Posted July 16, 2011 Try something like: If [ Year ( YourTable::YourDateField ) < Year ( Get (CurrentDate) ) ] # DO THE THING ... Else Beep End If Thank you very much it works I want also this for the previous year. i have 2009 as latest records. how can do it for previous years?
Vaughan Posted July 16, 2011 Posted July 16, 2011 Instead of Year( get( CurrentDate ) ) create a global number field to store the Year of the calendar.
comment Posted July 16, 2011 Posted July 16, 2011 I want also this for the previous year. i have 2009 as latest records. I think you mean earliest? How about: If [ Year ( YourTable::YourDateField ) > 2009 ] ... I am not too crazy about hard-coding data, but if you're not backdating records, it should do. Otherwise you'd have to do something like: Set Variable [ $firstYear ; Year ( sMinDate ) ] Freeze Window Show Omitted Only Set Variable [ $firstYear ; Min ( $firstYear ; Year ( sMinDate ) ) ] Show Omitted Only If [ Year ( YourTable::YourDateField ) > $firstYear ] ... where sMinDate is a summary field defined as Minimum of [YourDateField].
Recommended Posts
This topic is 4879 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 accountSign in
Already have an account? Sign in here.
Sign In Now