Robert Collins Posted June 9, 2005 Posted June 9, 2005 I am trying to paste a calculated result into a a date field The calculation is the following 1/next month/current year..endday/next month/current year in other words I need to find all records from the following month I hope that makes sense. thanks
aaa Posted June 9, 2005 Posted June 9, 2005 Try like this: Insert Calc Result[Date_Field, DateToText(Date(Month(today),1,Year(Today))&".."& DateToText(Date(Month(today)+1,1,Year(Today))-1)
LaRetta Posted June 9, 2005 Posted June 9, 2005 I prefer using Enter Find Mode [ ] and Set Field [ ] here. You don't have to have the field on layout as Insert Calculated Result [ ] requires and vs. 7 now allows calcs on date fields in finds. Today isn't in vs. 7: Date(Month(Get(CurrentDate)) + 1; 1; Year(Get(CurrentDate))) & "..." & Date(Month(Get(CurrentDate)) + 2; 0; Year(Get(CurrentDate))) Or even ... Let( d = Get(CurrentDate); Date(Month(d) + 1; 1; Year(d)) & "..." & Date(Month(d) + 2; 0; Year(d)) ) I'm unsure if Let() helps here but it's sure easier to work with. LaRetta
Robert Collins Posted June 9, 2005 Author Posted June 9, 2005 thanks for the replies , I shall try both of those
Robert Collins Posted June 10, 2005 Author Posted June 10, 2005 Ok, I've got Laretta's first calculation working fine in FM7. But I couldn't get aaa's calc working in FM5. this is what I have entered in the Insert calculated result box as a script step (which I am happy to use insert calc result in a script as I do have the field on the layout) DateToText(Date(Month(today),1,Year(Today))&".."& DateToText(Date(Month(today)+1,1,Year(Today))-1)
Robert Collins Posted June 10, 2005 Author Posted June 10, 2005 It's Ok , I've worked out what I did wrong. I am now trying to go one stage further and instead of having a button to trigger the script, I would like to have a pop-up menu that lists not only the name of next month but all of the following months.depending on which month was clicked, it would alter the script to account for the month chosen. How easy would it be to create a value list based on a calculated result (i.e. always show the following months and not a static list. thanks again
aaa Posted June 10, 2005 Posted June 10, 2005 You must have one global field Month_Global where will you put your choosing month then in expression instead Month(today) you must put Month_Global. Other way is to create 12 buttons and 12 scripts. For user this way is more appreciate.
Robert Collins Posted June 10, 2005 Author Posted June 10, 2005 the problem I see with the buttons is that if the current month is June and someone clicks the January button it would show records from the previous January and not the forthcoming one.With your first suggestion , should I create a value list with all 12 months? I'm a little unclear of this. thanks
aaa Posted June 10, 2005 Posted June 10, 2005 Yes! You right. You must create value list. Today i finishrd my work. Tomorrow, if you can not solve your problem, i will attach you example. You must choose Month_Global from Value List then find by: DateToText(Date(Month_Global,1,Year(Today))&".."& DateToText(Date(Month_Global+1,1,Year(Today))-1)
Robert Collins Posted June 10, 2005 Author Posted June 10, 2005 thanks , an attachment would be very useful
Robert Collins Posted June 11, 2005 Author Posted June 11, 2005 thanks , i will have a play with that
Recommended Posts
This topic is 7174 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