P-Matt
27th September 2004, 21:49
I am writing an hours accounting report, and need to combine the tihra100.year and tihra100.week fields into a yyyyww field to use for comparison.
Does anyone know how to do this?
Thanks in advance!
P-Matt.
lbencic
27th September 2004, 22:14
Just for sorting, grouping, comparing greater than or less than, for simplicity I just use:
year * 100 + week
This would give you your YYYYWW format
Same with Date / Time in Baan IV, I use:
(date * 10000) + time (military time HHMM)
or
(date*1000000) + time (HHMMSS time)
mark_h
27th September 2004, 22:27
Just a thought - but can't you let them enter year.f/week.f to year.t/week.t and then convert it to a date. Then use these dates in the query range? This is what I do for some of my sfc reports. It was easier to do that than to write a query against the table.
Mark
P-Matt
27th September 2004, 22:52
lbencic,
Thanks a ton - That is exactly what I was looking for. This will allow me to take not only my input week/year but my tihra100 week/year and compare each.
I have a feeling I will be using this formula a lot in the future.
Thanks again!!
günther
28th September 2004, 11:23
Just a thought - but can't you let them enter year.f/week.f to year.t/week.t and then convert it to a date. Then use these dates in the query range? This is what I do for some of my sfc reports. It was easier to do that than to write a query against the table.
Mark
That makes life a bit more complicated. You then run into the problem "how many days has the last month" which can be solved by a bit more code: find the date of the 1st day of the next month, and use the day before that.
günther
mark_h
28th September 2004, 15:30
Actually that is what I do - I use >= for the from date and < for the to date. Works really well when those pesky users just have to be able to enter either a year/wk range or a year/month range. In the case of the year week I increase week by 1 to get the first day of the next week in the calendar. This beats the heck out of trying to write code to do a query for year/wk ranges. :)
Mark
lbencic
28th September 2004, 16:46
It's a matter of what table - the HRA table has the primary key by year and week, not date. People generally want to see weekly buckets of information. The sfc stuff is usually by date and people generally want monthly tracking.