Skip to main content
Announcements
A fresh, new look for the Data Integration & Quality forums and navigation! Read more about what's changed.
cancel
Showing results for 
Search instead for 
Did you mean: 
AlessandroCic
Contributor III

Reading and parsing Google Calendar ics file

Hi forum
In another post I asked about to query Google Calendar item
url=http://www.talendforge.org/forum/viewtopic.php?pid=126354#p126354
I hope that the developer find a way to do this.
Meantime I try another method to read Google Calendar item: in Google there is the possibility to export the calendar in a structured text file with ics extension that it's something like this:
BEGIN:VEVENT
DTSTART:20140107T090000Z
DTEND:20140107T120000Z
DTSTAMP:20140129T164854Z
UID:@google.com
CREATED:20140108T080811Z
DESCRIPTION:Descriprion 1° event
LAST-MODIFIED:20140108T080831Z
LOCATION:
SEQUENCE:1
STATUS:CONFIRMED
SUMMARY:Object 1° event
TRANSP:OPAQUE
END:VEVENT
BEGIN:VEVENT
DTSTART:20131224T073000Z
DTEND:20131224T080000Z
DTSTAMP:20140129T164854Z
UID:@google.com
CREATED:20131223T165249Z
DESCRIPTION:Descriprion 2° event
LAST-MODIFIED:20140107T075355Z
LOCATION:
SEQUENCE:0
STATUS:CONFIRMED
SUMMARY:Object 2° event
TRANSP:OPAQUE
END:VEVENT
.....

It's a sequential file where every event is distinct between the sections
BEGIN:VEVENT

END:VEVENT

Isn?t guaranteed that each section have the same number of rows and the same sequence.
Therefore it would be necessary generate a cycle that it identify the begin and the end of the section to create new DB row.
Then on have to identify the data row by row to assign to a corresponding field.
Is there a Talend component that it running this big job?
Or what components could I use to develop this?
Regards
Alessandro
Labels (2)
12 Replies
Anonymous
Not applicable

To your question, no this is not guaranteed. If a event has same attributes unlike others than the entries can differ.
Currently there is no component dedicated to this format. I would do this job with a Java class parsing this file line by line and accumulate the Events in objects. It is very easy to do.
Do you think, this task will be done often? I suggest creating a JIRA feature request for a new component to handle ICS files.
AlessandroCic
Contributor III
Author

Hi Jlolling thanks for your replay.
I had already begun to develop Java code for this function.
I'm using the component tFileInputFullRow to read my .ics file then with an "Iterate" collector I pass to a tJava component.
Is what the name of the variable to use to get the row value from tFileInputFullRow?
I suppose something like this
((String)globalMap.get("tFileInputFullRow_1_xxxx"));

Regard
AlessandroCic
Contributor III
Author

Hi forum
can anyone tell me the property to use to extract the value of the line?
The work that I am developing is as shown in the image but I do not know the right parameter ("tFileInputFullRow_1_line" is wrong!)
Thanks to everyone.
Alessandro
AlessandroCic
Contributor III
Author

Up..
AlessandroCic
Contributor III
Author

Hi forum
no suggestions for my issue?
In another job where I'm using tFileList I received the suggestion to use the property tFileList_1_CURRENT_FILE, tFileList_1_CURRENT_FILEDIRECTORY, tFileList_1_CURRENT_FILEPATH which have been very useful for the development.
Using tFileInputFullRow I think there are some similar properties but I could not find documentation on this.
Help me please.
Thanks to everyone.
Alessandro
Anonymous
Not applicable

Hi Alessandro
The global variable (Integer)globalMap.get("tFileInputFullRow_1_NB_LINE") on tFileInputFullRow_1 is used to count the total number of lines are read from the file. I don't understand why you are using the iterate link. What data do you want to extract from the file? or you just need to count the number of events (that starts from BEGIN:VEVENT and ends with END:VEVENT)?
Shong
AlessandroCic
Contributor III
Author

Hi Shong
Thanks for your attention.
With tFileInputFullRow I would like to read line by line the .ics file, fot this I think to use the iterate link.
In a tJava component I would like to have the contents of the line and to parse it to identify the kind of row.
Then if I my row start (es.) with SUMMARY: or DTSTART: I take the value after ":" and I save the value in a structure with a row for each event with the field required.
The global variable (Integer)globalMap.get("tFileInputFullRow_1_NB_LINE") can to be helpful but in first time I must have the content of the row.
What is the global variable to get the row string? How can I find documentation about this?
Regards
Alessandro
AlessandroCic
Contributor III
Author

Hi people
Is it really so hard to have this information?
I have not found documentation about global variables, Is it necessary from someone to help me.
Thanks, regards.
Alessandro
AlessandroCic
Contributor III
Author

Up.
Help me please.
The information required is:
the global variable related to component tFileInputFullRow to get the content of current the row.
Then I would like to manipulate it in a jJava component.
Thanks, regards.
Alessandro