Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 325
  • Last Modified:

Adding additional columns to calendar view

Hi Guys

Is it possible to show more information in a Calendar view

I would like to add something like this to a location column
D:= @If(StartDate_2 != ""; location; "");
D1:= @If(StartDate_3 != ""; location_1; "");
D2:= @If(StartDate_4 != ""; location_2; "");
D3:= @If(StartDate_5 != ""; location_3; "");

@Trim(D:D1:D2:D3)

Columns 1 and 2 have

d := @If( StartDate = "" | EndDate = ""; ""; @Explode( @TextToTime( @Text(StartDate) + "-" + @Text(EndDate) ) ));
d1 := @If( StartDate_1 = "" | EndDate_1 = ""; ""; @Explode( @TextToTime( @Text(StartDate_1) + "-" + @Text(EndDate_1) ) ));
d2 := @If( StartDate_2 = "" | EndDate_2 = ""; ""; @Explode( @TextToTime( @Text(StartDate_2) + "-" + @Text(EndDate_2) ) ));
d3 := @If( StartDate_3 = "" | EndDate_3 = ""; ""; @Explode( @TextToTime( @Text(StartDate_3) + "-" + @Text(EndDate_3) ) ));
d4 := @If( StartDate_4 = "" | EndDate_4 = ""; ""; @Explode( @TextToTime( @Text(StartDate_4) + "-" + @Text(EndDate_4) ) ));

vac := @TextToTime(@Trim( d:d1 : d2 : d3 : d4 ));

dateRange := @TextToTime(@Replace( @Text(Vac); @Text(holidays); "" ) );


dateRangeTextList := @Explode(dateRange);
dateRangeDateList := @TextToTime(dateRangeTextList);
dayOfWeekNumberList := @Weekday(dateRangeDateList);
dayOfWeekTextList := @Text(dayOfWeekNumberList);
weekEndList := @Replace(dayOfWeekTextList; "2" : "3" : "4" : "5" : "6"; "" : "" : "" : "" : "" : "" + "IS A WEEKDAY");
dateRangeWithComment := dateRangeTextList + weekEndList;
weekDayDates := @Left(dateRangeWithComment; "IS A WEEKDAY");

holidayTextList := @Text(holidays);
workDayDateTextList := @Replace(weekDayDates; holidayTextList; "");
finalTextList := @Trim(workDayDateTextList);
finalDateList := @TextToTime(finalTextList);
finalDateList

Column 3 is RequesterName


James
0
adspmo
Asked:
adspmo
  • 13
  • 11
  • 5
1 Solution
 
HemanthaKumarCommented:
Well you can add more columns on the right of 3rd col.. it will show up as popup text in a box.

And also you can concat values in col 3 to show it on view.. anyway it will get truncated due to spacing managed automatically by calendar

~Hemanth
0
 
qwaleteeCommented:
Hi adspmo,

Sure, a calendar is like ny other view, once you get past these differences:

1) First few columns are used to control calendar placement (dates, start times, durations)

2) Calendar display formats are not the same -- regular views use a full row per document, calendar views obvisoul break that up using a calendar-based grid

3) Because ofthe "tightness," calendarrs supporta  hover-to-view-the-rest of teh cutoff entry feature.  I don't remember if it only applies to the first visible column, though.

So, like any view, you can create new columns (at the end, or just anywhere past the calendar control columns).  And you can place additional text in an existing column formula to include more text in that column.

You might want to consider using multiple lines per document, which is a view option.  That way, it won't get cut off.

Best regards,
qwaletee
0
 
adspmoAuthor Commented:
Hi

I have it showing the info however it is showing in the wrong place
e.g.

Start 25/11/2003  End 28/11/2003    Location YYZ
Start 30/11/2003 End 5/12/2003       Location CCH

etc........

I need to get the Location info spanning the correct dates only
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
HemanthaKumarCommented:
Now that is going to be a problem !

In order to matchup the multivalues with prev col data.. it is not possible ! Unless you create record for each start and end dates.

0
 
qwaleteeCommented:
I'm confused.  What's the problem?
0
 
adspmoAuthor Commented:
Hi

I wanted to show That I am in Toronto for two days .Paris for a day New York for three days etc..

This is done off a form that has multiple Start and End Dates and Location fields

James
0
 
adspmoAuthor Commented:
Also I asked a question about needing to ctreate multiple forms based on these fields having data in them when the original form was saved

http://www.experts-exchange.com/Applications/Email/Lotus_Notes/Q_20803090.html

Maybe we should revisit that idea


James
0
 
qwaleteeCommented:
Toronto for two days -- are you using a date range in the calendar date column, or a multiple-value date list field?

The multiple forms is a reasonable, though somehat complicated, idea.  I would simply copy the current form to a new document, make it a response to the original document, add a flag field to indicate that this is a "shadow," (or maybe just change the form), and drop the "lists" down to "singles."  (Start/end dates and "description, which is city.)
0
 
adspmoAuthor Commented:
The whole point of this form is that a person can open a single document and in put upto four different date ranges

In the colums I am using a variation of this
d1 := @if( StartDate_1 = "" | EndDate_1 = ""; ""; @Explode( @TextToTime( Text(StartDate_1) + "-" + @Text(EndDate_1) ) ));
d2 := @if( StartDate_2 = "" | EndDate_2 = ""; ""; @Explode( @TextToTime( Text(StartDate_2) + "-" + @Text(EndDate_2) ) ));
d3 := @if( StartDate_3 = "" | EndDate_3 = ""; ""; @Explode( @TextToTime( Text(StartDate_3) + "-" + @Text(EndDate_3) ) ));
d4 := @if( StartDate_4 = "" | EndDate_4 = ""; ""; @Explode( @TextToTime( Text(StartDate_4) + "-" + @Text(EndDate_4) ) ));

@Trim( d1 : d2 : d3 : d4 );


I would like to do whatever gets the jon done. Whether it is response, shadow or a new scripted document doesn' t matter

Whatever is the quickest way and reliable.

James
0
 
qwaleteeCommented:
adspmo,
> Whether it is response, shadow or a new scripted document doesn' t matter
How about "all of the above."

These would be "shadow" documents created via script ("scripted documents,") and the particular way they wouuld be created is as response documents.
0
 
adspmoAuthor Commented:
Ok

so where do we begin

The new form would have to contain all information that is in the parent , except for the start and end date fields they would be singular. If on the parent the up to 4 date ranges are not empty then a new form for each ot the 4 date ranges would have to be created. Also they would have to show in the calendar views only
0
 
qwaleteeCommented:
Don't bother creating a new form.  Re-use the existiong form, but don't allow editing if the shadow flag is present.  In fact, if someone attempts to open the document, redrect him to teh parent document.
0
 
adspmoAuthor Commented:
These would be "shadow" documents created via script ("scripted documents,") and the particular way they wouuld be created is as response documents.

I cannot use the existing form because it contains multiple Start and End Dates and they do not show up on the calendar with descriptions properly.

When the original is saved and if
Startdate_1 and EndDate_1, Startdate_2 and EndDate_2, Startdate_3 and EndDate_3, Startdate_4 and EndDate_4 are not empy then a new document must be created showing all the original document info plus only the ,Startdate_1 and EndDate_1 and another for Startdate_2 and EndDate_2 etc... so I can show the relevant location information in the calendar.

James
0
 
HemanthaKumarCommented:
Shadow Doc can be something which is not associated with any form but some virtual form, and it may cause some error while opening and uses default form of the db so you can point it to the form with multiple start and end date in calendar views form formula.

Always reference this shadow doc with original parent document id (or as responses)
0
 
qwaleteeCommented:
I don't see any problem with re-using the form... just make sure, when copying values, that for each document, you "skip" the extra start/end/location lines (i.e., for shadow 1, only copy fields for the first line, for shadow 2, only fields for the second line, etc.)
0
 
adspmoAuthor Commented:
I do not know how do this

James
0
 
HemanthaKumarCommented:
In the save or button inlcude this script which does create doc for eact start and end dates

Dim ws as New NotesUIWorkspace
Dim uidoc as NotesUIDocument
dim s as new notessession
dim db as notesdatabase
dim doc as notesdocument
set db = s.CurrentDatabase
set doc = db.CreateDocument
doc.Form = "Shadow Form"
doc.StartDate = uidoc.Document.StartDate
doc.EndDate = uidoc.Document.EndDate
doc.Subject = uidoc.Document.Subject
doc.Save true, false

0
 
adspmoAuthor Commented:
Will I have to modify this for
StartDate_2, StartDate_#.....etc Same for EndDate

James
0
 
HemanthaKumarCommented:
yes
0
 
qwaleteeCommented:
This will handle all the dates...

Dim suffixes(1 to 4) as string, startDate as variant, endDate as variant, Subject as string
suffixes(1) = "" 'the first one is just plain StartDate, EndDate, Subject
suffixes(2) = "_1" 'StartDate_1, EndDate_1, Subject_1
suffixes(3) = "_2"
suffixes(4) = "_3"

Dim ws as New NotesUIWorkspace
dim s as new notessession
dim doc as notesdocument
Forall suffix in suffixes
  set doc = ws.currentDocument.Document.copyToDatabase ( s.currentDatabase )
  startDate = doc.getItemValue("StartDate" & suffix)
  endDate = doc.getItemValue("EndDate" & suffix)
  subject = doc.getItemValue("Subject" & suffix)(0)

  Forall dropSuffix in suffixes
    doc.removeItem "StartDate" & dropSuffix
    doc.removeItem "EndDate" & dropSuffix
    doc.removeItem "Subject" & dropSuffix
  End Forall
  doc.shadowFlag = "1"
  doc.StartDate = startDate
  doc.EndDate = endDate
  doc.Subject = subject
  doc.Save true, false
End Forall
0
 
qwaleteeCommented:
Oh, and change your form's QueryOpen:

If source.documet.shadowFlag(0) = "1" Then
  continue = false
  end
End If
0
 
qwaleteeCommented:
Actually, I misdefined suffixes, and I used SUBJECT instead of location...

Dim suffixes(1 to 5) as string, startDate as variant, endDate as variant, Location as string
suffixes(1) = "" 'the first one is just plain StartDate, EndDate, Location
suffixes(2) = "_2" 'StartDate_1, EndDate_1, Location_1
suffixes(3) = "_3"
suffixes(4) = "_4"
suffixes(5) = "_5"


Dim ws as New NotesUIWorkspace
dim s as new notessession
dim doc as notesdocument
Forall suffix in suffixes
  set doc = ws.currentDocument.Document.copyToDatabase ( s.currentDatabase )
  startDate = doc.getItemValue("StartDate" & suffix)
  endDate = doc.getItemValue("EndDate" & suffix)
  Location = doc.getItemValue("Location" & suffix)(0)

  Forall dropSuffix in suffixes
    doc.removeItem "StartDate" & dropSuffix
    doc.removeItem "EndDate" & dropSuffix
    doc.removeItem "Location" & dropSuffix
  End Forall
  doc.shadowFlag = "1"
  doc.StartDate = startDate
  doc.EndDate = endDate
  doc.Location = Location
  doc.Save true, false
End Forall

0
 
adspmoAuthor Commented:
Hi Qwaletee

Where would I put this script you provided

GLobal,Agent ??
0
 
qwaleteeCommented:
You could put it in the QuerySave.  That would cause every create or update (which always result in a form save) kicking off the code.  The ws duplicates the Source parameter, but it should all work.

Only one issue: if a document is saved more than once, it produces duplicates, but I can fix that if you like

0
 
adspmoAuthor Commented:
Please do I need to get this issue solved,
Also these new dox will need to show in a calendar view. That is the reason I am doing this

James


If it works the bonus points will fly
0
 
qwaleteeCommented:
Try this.  I will get around the problem of the duplicates by making the shadows into responses of the main document, and y dleeting any existing responses before creating new shadows.  The calendar view should SELECT shadowFlag = "1"

In QueryOpen:
If Source.document.shadowFlag(0) = "1" Then
  continue = false
  Dim s as new notesSession
  Dim db as notesDatabase
  Set db = s.currentDatabase
  Dim parent as notesDocument
  Set parent = db.getDocumentByUNID(Source.document.parentDocumentUNID)
  Dim ws as new notesUiWorkspace
  ws.editDocument False , parent
End If

In QueySave:

Dim suffixes(1 to 5) as string, startDate as variant, endDate as variant, Location as string
suffixes(1) = "" 'the first one is just plain StartDate, EndDate, Location
suffixes(2) = "_2" 'StartDate_1, EndDate_1, Location_1
suffixes(3) = "_3"
suffixes(4) = "_4"
suffixes(5) = "_5"


Dim ws as New NotesUIWorkspace
dim s as new notessession
Dim main as notesDocument
Set main = ws.currentDocument.Document
main.responses.removeAll True
dim shadow as notesdocument
Forall suffix in suffixes
  set shadow = main.copyToDatabase ( s.currentDatabase )
  shadow.makeresponse main 'sets the new shadow to be a response doc
  startDate = shadow.getItemValue("StartDate" & suffix)
  endDate = shadow.getItemValue("EndDate" & suffix)
  Location = shadow.getItemValue("Location" & suffix)(0)

  Forall dropSuffix in suffixes
    shadow.removeItem "StartDate" & dropSuffix
    shadow.removeItem "EndDate" & dropSuffix
    shadow.removeItem "Location" & dropSuffix
  End Forall
  shadow.shadowFlag = "1"
  shadow.StartDate = startDate
  shadow.EndDate = endDate
  shadow.Location = Location
  shadow.Save true, false
End Forall
0
 
adspmoAuthor Commented:
Hi
I get Object variable not set on


If Source.document.shadowFlag(0) = "1" Then

I did add a shadowflag field to the form as text editable default value "0"

james
0
 
qwaleteeCommented:
That's in the QurySave event?  Plese run it throuh the debugger, and check that:

1) Source is a NotesUiDocument
2) Source.document exists, and is a notesDocument

You can also try this instead of If Source.document.shadowFlag(0) = "1" Then

Dim sourceBackEnd as notesDocument
Set sourceBackEnd = Source.document
If sourceBackEnd.shadowFlag(0) = "1" Then

You do NOT need to add ShadowFlag to you form.  The code works perfectly if shadowFlag does not exist.
0
 
qwaleteeCommented:
Whoa!  Again!

What's cooking, James?
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 13
  • 11
  • 5
Tackle projects and never again get stuck behind a technical roadblock.
Join Now