Re: Creating a Ical ics file
Hi Stan,
Thanks for the reply.
Just did a test run, works pretty good, thanks
Walter
Announcement
Collapse
The Alpha Software Forum Participation Guidelines
The Alpha Software Forum is a free forum created for Alpha Software Developer Community to ask for help, exchange ideas, and share solutions. Alpha Software strives to create an environment where all members of the community can feel safe to participate. In order to ensure the Alpha Software Forum is a place where all feel welcome, forum participants are expected to behave as follows:
Be sure all comments and threads you post are respectful. Posts that contain any of the following content will be considered a violation of your agreement as a member of the Alpha Software Forum Community and will be moderated:
If a thread or post is found to contain any of the content outlined above, a moderator may choose to take one of the following actions:
Moderators may also rename posts and threads if they are too generic or do not property reflect the content.
Moderators may move threads if they have been posted in the incorrect forum.
Threads/Posts questioning specific moderator decisions or actions (such as "why was a user banned?") are not allowed and will be removed.
The owners of Alpha Software Corporation (Forum Owner) reserve the right to remove, edit, move, or close any thread for any reason; or ban any forum member without notice, reason, or explanation.
Community members are encouraged to click the "Report Post" icon in the lower left of a given post if they feel the post is in violation of the rules. This will alert the Moderators to take a look.
Alpha Software Corporation may amend the guidelines from time to time and may also vary the procedures it sets out where appropriate in a particular case. Your agreement to comply with the guidelines will be deemed agreement to any changes to it.
Bonus TIPS for Successful Posting
Try a Search First
It is highly recommended that a Search be done on your topic before posting, as many questions have been answered in prior posts. As with any search engine, the shorter the search term, the more "hits" will be returned, but the more specific the search term is, the greater the relevance of those "hits". Searching for "table" might well return every message on the board while "tablesum" would greatly restrict the number of messages returned.
When you do post
First, make sure you are posting your question in the correct forum. For example, if you post an issue regarding Desktop applications on the Mobile & Browser Applications board , not only will your question not be seen by the appropriate audience, it may also be removed or relocated.
The more detail you provide about your problem or question, the more likely someone is to understand your request and be able to help. A sample database with a minimum of records (and its support files, zipped together) will make it much easier to diagnose issues with your application. Screen shots of error messages are especially helpful.
When explaining how to reproduce your problem, please be as detailed as possible. Describe every step, click-by-click and keypress-by-keypress. Otherwise when others try to duplicate your problem, they may do something slightly different and end up with different results.
A note about attachments
You may only attach one file to each message. Attachment file size is limited to 2MB. If you need to include several files, you may do so by zipping them into a single archive.
If you forgot to attach your files to your post, please do NOT create a new thread. Instead, reply to your original message and attach the file there.
When attaching screen shots, it is best to attach an image file (.BMP, .JPG, .GIF, .PNG, etc.) or a zip file of several images, as opposed to a Word document containing the screen shots. Because Word documents are prone to viruses, many message board users will not open your Word file, therefore limiting their ability to help you.
Similarly, if you are uploading a zipped archive, you should simply create a .ZIP file and not a self-extracting .EXE as many users will not run your EXE file.
- Be professional in your conduct
- Be kind to others
- Be constructive when giving feedback
- Be open to new ideas and suggestions
- Stay on topic
Be sure all comments and threads you post are respectful. Posts that contain any of the following content will be considered a violation of your agreement as a member of the Alpha Software Forum Community and will be moderated:
- Spam.
- Vulgar language.
- Quotes from private conversations without permission, including pricing and other sales related discussions.
- Personal attacks, insults, or subtle put-downs.
- Harassment, bullying, threatening, mocking, shaming, or deriding anyone.
- Sexist, racist, homophobic, transphobic, ableist, or otherwise discriminatory jokes and language.
- Sexually explicit or violent material, links, or language.
- Pirated, hacked, or copyright-infringing material.
- Encouraging of others to engage in the above behaviors.
If a thread or post is found to contain any of the content outlined above, a moderator may choose to take one of the following actions:
- Remove the Post or Thread - the content is removed from the forum.
- Place the User in Moderation - all posts and new threads must be approved by a moderator before they are posted.
- Temporarily Ban the User - user is banned from forum for a period of time.
- Permanently Ban the User - user is permanently banned from the forum.
Moderators may also rename posts and threads if they are too generic or do not property reflect the content.
Moderators may move threads if they have been posted in the incorrect forum.
Threads/Posts questioning specific moderator decisions or actions (such as "why was a user banned?") are not allowed and will be removed.
The owners of Alpha Software Corporation (Forum Owner) reserve the right to remove, edit, move, or close any thread for any reason; or ban any forum member without notice, reason, or explanation.
Community members are encouraged to click the "Report Post" icon in the lower left of a given post if they feel the post is in violation of the rules. This will alert the Moderators to take a look.
Alpha Software Corporation may amend the guidelines from time to time and may also vary the procedures it sets out where appropriate in a particular case. Your agreement to comply with the guidelines will be deemed agreement to any changes to it.
Bonus TIPS for Successful Posting
Try a Search First
It is highly recommended that a Search be done on your topic before posting, as many questions have been answered in prior posts. As with any search engine, the shorter the search term, the more "hits" will be returned, but the more specific the search term is, the greater the relevance of those "hits". Searching for "table" might well return every message on the board while "tablesum" would greatly restrict the number of messages returned.
When you do post
First, make sure you are posting your question in the correct forum. For example, if you post an issue regarding Desktop applications on the Mobile & Browser Applications board , not only will your question not be seen by the appropriate audience, it may also be removed or relocated.
The more detail you provide about your problem or question, the more likely someone is to understand your request and be able to help. A sample database with a minimum of records (and its support files, zipped together) will make it much easier to diagnose issues with your application. Screen shots of error messages are especially helpful.
When explaining how to reproduce your problem, please be as detailed as possible. Describe every step, click-by-click and keypress-by-keypress. Otherwise when others try to duplicate your problem, they may do something slightly different and end up with different results.
A note about attachments
You may only attach one file to each message. Attachment file size is limited to 2MB. If you need to include several files, you may do so by zipping them into a single archive.
If you forgot to attach your files to your post, please do NOT create a new thread. Instead, reply to your original message and attach the file there.
When attaching screen shots, it is best to attach an image file (.BMP, .JPG, .GIF, .PNG, etc.) or a zip file of several images, as opposed to a Word document containing the screen shots. Because Word documents are prone to viruses, many message board users will not open your Word file, therefore limiting their ability to help you.
Similarly, if you are uploading a zipped archive, you should simply create a .ZIP file and not a self-extracting .EXE as many users will not run your EXE file.
See more
See less
Creating a Ical ics file
Collapse
X
-
Re: Creating a Ical ics file
I have always handled this by creating a new file, writing the desired header line, writing the original data, and saving. At this point the original file can be replaced and the new file renamed to the name of the original file.
Just now occurred to me. Since we know that the text in the original file is being overwritten to the length of the addition and the original data+ header line is longer than the original data............
Code:contents = file.to_string("p:\08062015.dat") contents = "HEADER_SAMPLE_1________1250RECORDS"+crlf()+contents dim file_pointer as P file_pointer = file.open("p:\08062015.dat",FILE_RW_EXCLUSIVE) file_pointer.seek(0) file_pointer.write(contents) file_pointer.flush() file_pointer.close()
Code:contents = file.to_string("p:\08062015.dat") contents = "HEADER_SAMPLE_1________1250RECORDS"+crlf()+contents file.from_string("p:\08062015.dat",contents)
Last edited by Stan Mathews; 06-08-2016, 08:23 AM.
Leave a comment:
-
Re: Creating a Ical ics file
Hi,
I am also exporting data to a text file and have created an export operation for this.
I would like to open the text file and insert a header string in the first line or row of the text file AFTER the export operation has completed. It must not overwrite or replace exported data.
I have done this so far, but cannot seem to get this correct:
dim file_pointer as P
file_pointer = file.open("C:\cms\08062015.dat",FILE_RW_EXCLUSIVE)
'showvar(pos)
file_pointer.seek(0)
file_pointer.write_line("HEADER_SAMPLE_1________1250RECORDS")
file_pointer.flush()
file_pointer.close()
Leave a comment:
-
Re: Creating a Ical ics file
Not pretty but it does the job.
This reads a child table for all records that belong to the parent table.
It then writes the data out into a .ics file for importing into Google Calendar, ZoHo Calendar or possibility any calendar that can import .ics files.
I am also attaching the test app for those who wish to play or maybe even make this better.
Code:dim global vt_tmstart as T dim global vt_tmend as T dim global vn_export_id as N dim vn_schedid as N dim basepath as c dim global filename as c dim file_name as c dim vc_event_id as C dim vn_priority as n dim vc_alarm as c dim vc_how as c dim vc_job as c dim Details as c dim vc_decript as c dim vc_equip as c dim notify as c dim notify1 as c dim notify2 as c if parentform.EXPORTED = .T. then DIM SHARED exportagain_result as N DIM SHARED exportagain_YES_Button as L DIM SHARED exportagain_NO_Button as L exportagain_YES_Button = .F. exportagain_NO_Button = .F. title_var = "Already Exported" message_text_var = <<%text% You have already exported this scheduling. Do you wish to export it again? %text% exportagain_result=ui_msg_box(title_var,message_text_var,UI_YES_NO+ UI_SECOND_BUTTON_DEFAULT+ UI_ATTENTION_SYMBOL) 'Test to see which button on the message box was pressed.... SELECT CASE exportagain_result = UI_YES_SELECTED exportagain_YES_Button= .t. CASE exportagain_result = UI_NO_SELECTED exportagain_NO_Button= .t. END END SELECT end if file_name = alltrim(parentform.SCHED_NAM)+".ics" if file_name = ".ics" then file_name = "default.ics" 'if no file name specified use default end if basepath = a5.Get_Path()+"\\" filename = basepath+"schedules\\"+file_name 'alltrim(filename) vn_export_id = parentform.SCHED_ID dim f as p f = file.create(Filename,FILE_RW_EXCLUSIVE) f.write_line("BEGIN:VCALENDAR") f.write_line("PRODID:Shop Cal T-Five") f.write_line("VERSION:2.0") tpi = table.open("sch_details") tpi.index_primary_put("") tpi.fetch_first() WHILE .not. tpi.fetch_eof() vn_schedid = tpi.sched_id vc_job=tpi.details vt_tmstart=tpi.tmstart vt_tmend=tpi.tmend vc_event_id="t5"+tpi.EVENT_ID vn_priority = tpi.priority vc_alarm = tpi.alarm vc_how=tpi.how vc_decript=tpi.notes vc_equip=tpi.equip if vn_schedid = vn_export_id then f.write_line("BEGIN:VEVENT") f.write_line("DTSTART:"+time("yyyyMMddT0h0m0sZ",vt_tmstart- (gettimezoneoffset()*3600))) f.write_line("DTEND:"+time("yyyyMMddT0h0m0sZ",vt_tmend- (gettimezoneoffset()*3600))) f.write_line("LOCATION:"+vc_equip) f.write_line("SUMMARY:"+vc_job) f.write_line("UID:"+vc_event_id) f.write_line("DESCRIPTION:"+vc_decript) if vc_alarm = "None" .OR. vc_alarm = "" then goto skipalarm else f.write_line("BEGIN:VALARM") f.write_line("ACTION:"+vc_how) notify1 = ltrim(vc_alarm,"0123456789") notify2 = case(notify1="Minute","M",notify1="minutes","M",notify1="Hour","H",notify1="Hours","H",notify1="Day","D",notify1="Days","D") notify = left(vc_alarm,2) notify = alltrim(notify)+notify2 f.write_line("TRIGGER;VALUE=DURATION;RELATED=START:-PT"+notify) f.write_line("END:VALARM") end if SKIPALARM: f.write_line("PRIORITY:"+vn_priority) f.write_line("END:VEVENT") end if tpi.fetch_next() END WHILE tpi.close() f.write_line("END:VCALENDAR") f.flush() f.close() parentform:EXPORTED.value = .T. topparent.commit()
Last edited by preston2; 08-25-2015, 08:17 PM.
Leave a comment:
-
Re: Creating a Ical ics file
"DTSTART:"+time("yyyyMMddT0h0m0sZ",t- (gettimezoneoffset()*3600)) = DTSTART:20150824T151500Z
Leave a comment:
-
Re: Creating a Ical ics file
All sorts of tricks available. Just have to apply them.
In one attack.....
Code:? mask(time("yyyyMMdd0h0m0s",t)," T Z") 'eight spaces, T, six spaces, Z = "20150825T093329Z"
Code:? time("yyyyMMddT0h0m0sZ",t) = "20150825T093329Z"
Leave a comment:
-
Re: Creating a Ical ics file
Thanks Stan.
Using what you posted in a slightly different way seems to get the results I need.
time("yyyyMMdd",Export_Sch->Tmstart) yields 20150825
time("0h0m0s",(Export_Sch->Tmstart- (gettimezoneoffset()*3600))) yields 145500
Putting those together to get 20150825T145500Z will now be easy.
Now I just need to build a loop to run through a table and pull out all info that matches a filter.
The end concept is they will be able to create a scheduling record that will have many jobs that will be scheduled for the week or month. Once they have all their job scheduling data in they can click a button that will run a script. It will will then read in and convert all records linked to the main scheduling id and then create the .ics file. Once that file is create they can then import the information into Google Calendar or ZoHo Calendar.
I will see where I get with this and either post back with the working script or any other questions I may run up against.
Stan, you have been a great help to me over a long time. You do not know how much I appreciate it. Thank you very much.
Leave a comment:
-
Re: Creating a Ical ics file
t = now()
? t
= 08/25/2015 09:33:29 75 am
? typeof(t)
= "T"
? time("MM/dd/yyyy",t)
= "08/25/2015"
? time("yyyyMMdd",t)
= "20150825"
? time("0h:0m:0s",t)
= "09:33:29"
tp = t+36000
? time("0h:0m:0s",tp)
= "19:33:29"
Leave a comment:
-
Creating a Ical ics file
I have read the post from Gary Flanigan http://msgboard.alphasoftware.com/al...ad.php?t=71247
While this is useful from what I can tell he is using the dates as D but the time as C. This does not seem to be the best for what I am trying to do.
In Alpha a Date as D is the date. 08/25/2015
A Time as T is Date and Time. 08/25/2015 02:00:00 00 am
In the ics file there are 2 date and times that need to be filled in as this will be for events which have a start and end date and time.
DTSTART and DTEND. The format would be as follows.
DTSTART:20150825T130000Z (08/25/2015 at 1300 zulu)
DTEND:20150825T170000Z
I need to figure out how to pull just the date out of the Time field. Once I can do that I think I can reformat it to the required order for the ics file by using something like this date_format(newstartdate,"yyyyMMdd")
Then I need to pull the time out of the Time field. I will then need to convert it to 24 hour format.Tags: None
Leave a comment: