I have tried both iCal Entities plugin (which seems to require I choose one entity or the other for the date field) and the iCal Feeds plugin, which seems to offer more flexibility. I still have to select one Date field, but I have tried using the Fields to rewrite the output to show both dates fields, and I have also tried the No Results option to show the other Date field.

Perhaps to complicate matters, one Content Type (Production) has Start and End Dates, with day granularity (to indicate when a production opens and closes). The other Content Type (Performance) is for individual performances of a Production, with hour and minute granularity (i.e. curtain time).

Am I missing something? I seem to be only able to get one type or the other, but never both at once like I can get in my regular Calendar view at http://gsopera.com/cal-prod/month.

Thanks for help! Using Date iCal 7.x-2.12+6-dev (2013-Oct-04) with current Views 3.7, Date 3.6, Calendar 3.4, CTools, etc.

Comments

coredumperror’s picture

Title: How to create feed with two content types and separate date fields » Support the use of multiple Date fields in one feed
Assigned: Unassigned » coredumperror
Category: support » feature

Unfortunately, you're running into one of Date iCal's limitations: it doesn't support the use of multiple different date fields. Because the project was original coded to also support using timestamp fields (like created date) for the iCal date value, it was necessary to make users specify a single date field. However, this is an entirely arbitrary limitation, and I could add a new option that will overcome it.

Fortunately, the iCal Fields plugin was designed specifically to overcome the Entity plugin's limitation of using only one content type. So if I were to add a new option that tells Date iCal to use all the available Date fields (and not the timestamp fields), it would be possible for Date iCal to support your setup.

However, you're the only person who's ever run into this limitation (and told me about it). I can implement it, but it'll take a little while, so please let me know if you're definitely in need of this enhancement (so I don't spend a bunch of time on something that won't get used).

bunthorne’s picture

First, let me say "wow" and thank you for your quick and helpful attention to my issue! You may be able to co-opt an alternate definition for the term "responsive design." LOL

As for the need, I can't speak for others. But I am certain that the concept of a calendar is by its very nature host to a variety of events and conditions; consider that the typical Outlook calendar already combines an all-day Holiday list with user-created appointments. So I suspect you will encounter this request again.

As for the solution, I am more than happy to help work through ideas, workarounds, testing, etc, but I'm not a developer.

Would it be easier to provide some kind of iCal Feed Aggregator, so that if you create multiple iCal Feeds and attach them to the same view, a single icon aggregates the feeds?

Try as I may, I cannot find any way to trick the iCal Fields plugin to pull dates from both Content Types and represent them in a single Date field for the selector. (Recall that I do not use Entity Reference to share the Date field across Content Types.) Was there something you were saying about Date fields vs. Timestamp that I did not understand?

Thanks again for jumping in on this one.

coredumperror’s picture

OK, I'll get to work on this feature as soon as I get a chance. I'm currently knee-deep in the re-write of the Feed importer plugin, though, so I can't guarantee any sort of time frame for when I'll be able to finish this.

As for things you can do on your end, I just thought of something that might work. Rather than trying to mess with Date iCal's settings, it might be possible to tell Views itself to pretend that both of your date fields are the same field. This would be fairly trivial if you were a developer, because you could write a function to alter the SQL query that Views issues, merging the data from both fields into one. But since you're not, you might look into existing modules that will do that for you. It doesn't look like Views has that kind of functionality built in.

bunthorne’s picture

I did try a few Views-based workarounds: I tried using one of the date fields to rewrite as the other date field when empty; I also tried creating a new field to hold the rewritten results from both of the other date fields. Neither one seemed to work to produce the data I needed in the Date iCal view. I can keep trying down this path a few more times.

Is there a way I can produce separate views for each Date field, then somehow merge the two views into a single feed?

coredumperror’s picture

I don't know of any way to merge multiple views. But I do have some good news: I'm essentially done with the feed importer re-write, so I can get started on this feature in relatively short order. I'm currently working on the 3.x branch of Date iCal, so if you want to download the new dev version to try it out, please feel free.

coredumperror’s picture

I'm done with the 3.x re-write, so I'll get to work on this feature next week (I only work on Date iCal during work hours).

If you could check out the 3.x-dev build, and let me know (via a new issue) if you have any problems with upgrading from Date iCal 2, I'd really appreciate it!

bunthorne’s picture

I updated a day or two ago, copied the View, and saw the same basic output and behavior as under Date iCal 2. I did it again just now with your latest build, and same results. Nothing appears different, which is what I think you expected. The view I had built continues to work the same way. So, onward!

coredumperror’s picture

Excellent. That's very good to hear.

I should be able to dive into writing this feature today.

coredumperror’s picture

Status: Active » Fixed

Hurray, this feature is done! I just pushed it up to git, so it may not appear in the 3.x-dev build for a few hours.

If you want to test the feature before the dev build is made, you can pull Date iCal directly from git.

The way this feature works is through a new option in the Fields plugin's Date field dropdown. Choose "First populated Date field" to make Date iCal use the first non-empty Date field value in the iCal feed.

bunthorne’s picture

The good news is that by simply changing the Date field to "First populated date field," my preview expanded to include both date types. Perfect!

But before celebrating, I have to go back in and make sure the feed is working, because in its current setup it isn't actually producing any entries in my own Google Calendar. I think I have something wrong in the setup, so I will go back and try working a view from scratch.

One question I have is in the instructions, it mentions creating a View first. I started with the existing Calendar view, which has Contextual Filters already supplied. So the path of my feed had to have those same contextual filters, which is what is (I think) limiting my view results to only what would be left this month--and I don't think I had any events in my data for the rest of this month. Should a general iCal feed have any contextual filters based on Date? If not, then perhaps we should (and by we, I mean that I can do it) rewrite the documentation to either describe how to work from an existing Calendar view (from template), or to avoid that method altogether if it is problematic.

I will be working on this tomorrow (which is today already).

coredumperror’s picture

Well, it's entirely reasonable to attach a new iCal Feed display to an existing Calendar view, as long as you intend to limit the iCal feed to only what would have appeared in that Calendar (which is rarely what you'd actually want). The current instructions tell users to start from a fresh View to make sure they aren't carrying any baggage from an existing View's settings, which is a common problem due to the way Views is designed.

I'd prefer to just stick with the current instructions, since introducing multiple versions of instructions for "How to create an iCal feed" will most likely just be confusing. Especially since there's already one version for the Entities plugin and another for the Fields plugin.

bunthorne’s picture

I started a new view, and was able to get all events of both content types to show. I figured I should filter for "upcoming" so as not to get events going backward, but I seem to be unable to create a Filter Group logic of (Published AND Content Type=Production|Performance) AND (Production End Date > Now OR Performance Date/Time > Now). Whenever I make that combination and save, Views moves one of the Date fields back to the first AND block.

Perhaps this is a Views bug and/or required feature. I will investigate. In the meantime, is iCal commonly intended to filter for future events?

coredumperror’s picture

Yeah, I've seen that kind of problem with filter settings before. I think I solved it by pushing the problematic field into it's own group, saving, and then moving it to the real group you want it in. Or maybe it was something to do with the Published flag? I vaguely recall that one being annoying.

I'm honestly sure not if iCal has any particular "preference" toward future events. It seems logical, though, since why would you want to add events to your calendar client which have already happened?

bunthorne’s picture

Okay, that worked ... but not easily. I had already tried it a few times--creating a third group, then moving the third group item back into the second group after save. It still reverted on me the first few times I tried it. One of the problems is that in reopening the Rearrange Filter window, the box sets appeared in a strange order: the first two groups were next to each other without an operator dividing them, then there were two operators, then the third group. When I went ahead and worked with that setup and moved the item in the third group into the second, and saved, I was able to reopen it again and see the two groups with two filters in each. That is where I could reset the internal operator on the second group to OR.

Message to others--keep trying :-)

Now I have a list of items that are filtered for > NOW on either of the two different date fields. Hooray!

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

-Mania-’s picture

Component: Code » iCal Import
Issue summary: View changes

The multiple dates on feed works great, thanks for that. However it seems to break the "Exclude Calendar Name" functionality under Feed style options. When I have that setting on with one date field and open the feed on Outlook it correctly places the appointment under the default user calendar. However when using multiple dates the appointments are instead saved into a new "Untitled" calendar. Any workaround for this?

coredumperror’s picture

Version: 7.x-2.x-dev » 7.x-3.x-dev

Could you please acquire the multi-date .ics file manually (copy the webcal:// url, change it to http://, then download the file) and attach it to a new issue? I can't tell, just from the code, what could be going wrong. So I need a sample of the feed that's causing this "Untitled" calendar to appear in your calendar app.

This ticket isn't really appropriate for the specific problem you're experiencing, so please open a new issue for this. Thanks.

-Mania-’s picture

Sorry about that, I have created a new issue here https://www.drupal.org/node/2318939.