Link to home
Start Free TrialLog in
Avatar of adspmo
adspmo

asked on

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
Avatar of HemanthaKumar
HemanthaKumar

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
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
Avatar of adspmo

ASKER

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
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.

I'm confused.  What's the problem?
Avatar of adspmo

ASKER

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
Avatar of adspmo

ASKER

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

https://www.experts-exchange.com/questions/20803090/Creating-a-form-when-another-form-is-saved-or-Another-way.html

Maybe we should revisit that idea


James
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.)
Avatar of adspmo

ASKER

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
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.
Avatar of adspmo

ASKER

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
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.
Avatar of adspmo

ASKER

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
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)
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.)
Avatar of adspmo

ASKER

I do not know how do this

James
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

Avatar of adspmo

ASKER

Will I have to modify this for
StartDate_2, StartDate_#.....etc Same for EndDate

James
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
Oh, and change your form's QueryOpen:

If source.documet.shadowFlag(0) = "1" Then
  continue = false
  end
End If
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

Avatar of adspmo

ASKER

Hi Qwaletee

Where would I put this script you provided

GLobal,Agent ??
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

Avatar of adspmo

ASKER

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
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
Avatar of adspmo

ASKER

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
ASKER CERTIFIED SOLUTION
Avatar of qwaletee
qwaletee

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Whoa!  Again!

What's cooking, James?