Hello,
I am pulling information from a web service in which I parse out the data to be stored in a 10.2 file geodatabase and then displayed on a web map showing only those events occurring for the next week from the current date. Most events are only one day, so this works fine. The problem I have is that some events are ongoing and if I pull from the start date field, I eventually lose them because it is 7 days past the current date. There is an EndDate field, so those events that are ongoing will have a different start and end date, I am just not sure how to represent not only features that start on the current date plus a week out, but also those that are ongoing between their start and end date. I am using the feature class to feature class tool in model builder with the following expression to create the feature class showing weekly events:
StartDate <= (CURRENT_DATE + 7) AND StartDate >= CURRENT_DATE
Is there a way to also select those features that are ongoing from the current date using the StartDate and EndDate fields?
Thanks for any advice!
Solved! Go to Solution.
Chris,
Thank You! I am sorry if I was not clear before, I met today with the client to make sure that is what she wanted. The file I attached does not have field names, let me know if you need me to reattach a new spreadsheet, the only 2 date fields are the ones I am referring to.
Do you also have field names that you use?
Hi Wes,
This is close, it definitely selects everything either starting or ending in the next week, which is better than what I had. I am not sure if this is possible with the way the data is structured, but I am trying to think of a way to capture not only these records the above query returns, but also those that my be ongoing, let's say every Tuesday between start and end dates that may not fall within the next week. For example, if an event starts 4/21/2015 and occurs every Wednesday until 10/31/2015 I will miss it with the queries I have tried.
I really appreciate your help and advice!!
I haven't tested but this should work
("StartDate" >= CURRENT_DATE AND "StartDate" <= CURRENT_DATE + 7) OR ("EndDate" >= CURRENT_DATE AND "EndDate" <= CURRENT_DATE +7) OR ("StartDate" <= CURRENT_DATE AND "EndDate" >= CURRENT_DATE +7)
Emily,
Did this work out for you?
Chris Smith i went back and tested on the sample data provided and it appears to have gotten everything in the time frame.
Hi Chris and Wes,
Yes, I am still testing but it appears that the last query you suggested Wes should do the trick. Thank you so much for both of your input on this!
Cool, it looked like Wes' script would do the trick!