Ok, I got it to work in a very round about way, but now I feel that my database is going to have a lot of extra data that might not be needed. What I have done is create a calculated field that saves the months name using this calculation, MonthName(Date(Month(SalaryStartDate)+1;Day(SalaryStartDate);Year(SalaryStartDate) )).
Now my worry is that I am going to have a lot of fields with the same data sitting in my database, and all it will be used for is to do a search to get the payslip lines for that month. I have an idea that I can build this into my search script when the admin searches for payslips by month, but I am unsure of the way to do the script.
If I use the calculated field, would it store the actual value there, or does it jsut recalculate it when it is needed. Cause I am just worried that I fill my database with repeating data.
MonthName takes a date as a parameter, not a number. When you feed it with a number this will evaluate to a date. The date 5 will be 05-01-0001 (january).
Cool, thanx for this.
I was able to get it working when I added in the Date(month;day;year) function. Now I need to find out, would it be better to use a calculated field to store the Month name, or should I script it in to insert the month name into the field? What I am trying to get is a field that I can use to search against should the client need to search for a prevous months payslip.
I have the thought of writing a search script with a whole bunch of if statements that would use the SalaryStartDate field as the match field, for example, If GlobalSearchField = "May", then search for SalaryStartDate = 26/04/2013 ( or where the month = "4".
In most cases, I would not insert the month name into a field. Any time you need to display the name of the month, you can use data formatting in the inspector's data tab to format the month field to include the name of the month.