Retrieve object with specific week

0
Hi everyone, I’m trying to retrieve an object with a specific date. The object should only be created once every week, and be associated with a TeamMember.  In my code I want to check if the object for the current week already exists. After the retrieve I check if the ‘list’ is empty or not with a split. This is my XPath constrain of the retrieve activity: [ProjectManagement.ProjectHours_HistoryHelper/ProjectManagement.ProjectHours/ProjectManagement.ProjectHours_TeamMember = $TeamMember] [week-from-dateTime(Week) = week-from-dateTime('[%BeginOfCurrentWeek%]')] Thus, in the first rule I retrieve the ‘HistoryHelper’ object from the current user. The second rule should only retrieve object with the current week. However, my code does not work. Does anyone have suggestions on how to solve this? Thanks in advance!
asked
3 answers
1

Hello Renze,

I would suggest that you just use [Week = '[%BeginOfCurrentWeekUTC%]'] and always assign the week to be '[%BeginOfCurrentWeekUTC%]'. 

I would also ensure that your date is not localised. 

Using UTC dates means that you’ll be getting the same result every time and should be able to reliably use simple “equals” without any additional function.

Hope this helps.

answered
0

Hi Renze,

I need some more information to help you. Is the ‘Week’ a DateTime attribute on your HistoryHelper object? Can you be more specific about what ‘my code does not work’ means?

If you are sure that that attribute has the correct timestamp, I would recommend you to have a seperate create Variable activity that creates the week-from-dateTime('[%BeginOfCurrentWeek%]') value. With debugging, you can check whether it gives an unexpected value.

answered
0

Did you try DateToCheck >= [%BeginOfCurrentWeek%] and DateToCheck <= [%EndOfCurrentWeek%]?

Regards,

Ronald

 

answered