Link to home
Start Free TrialLog in
Avatar of coronoahcoro
coronoahcoroFlag for United States of America

asked on

Blank, Text, and Date in one column in Lotus Notes View

This question is related to this question:
https://www.experts-exchange.com/questions/26551298/Use-color-on-Lotus-Notes-View.html

My question can be seen on the link above (the 4th post before the last). The users now want the ability to have a blank, 'PA', and date approved in one column in a view and it has to be sorted correctly.

What is the possible solution for this?
Avatar of Sjef Bosman
Sjef Bosman
Flag of France image

And here's a copy of my latest remark:

There are 2 ways you can sort that column:
1. convert date values to a YYYYMMDD string, like "20101118"
2. leave the date value, and add a to the left of it, with a string value like "    20101118" (the additional spaces serve to hide the value; the column should be fixed-width, 1 character)
Avatar of coronoahcoro

ASKER

I am really confused about your solution # 2.

Your #1 solution makes sense but now how do I let the users to be able to put pending approval or even to leave it blank. I have a CustomerApprovalDate field which is a date field. I can have a text field to convert that date to text but then the users need to be able to change that to PA or blank.
Darn!! I word got removed, so sorry!!

2. leave the date value, and add a column to the left of it, with a string value like "    20101118" (the additional spaces serve to hide the value; the column should be fixed-width, 1 character)
Not "I word", but A word... sheesh what's wrong with ma keyboard...  ;-))
hahah keyboard is always wrong.

Anyway after trying different things, I ended up using LotusScript and Form event. I was hoping to just use formula language. But sjef I really want to try your method but I still don't understand your suggestion. If I understand correctly, then this is what you suggested:
1. Leave the date value in the form and view
2. Add a column to the left of that date column in the view, fixed width, 1 character.
3. Now I'm lost on this part: " ... with a string value like "    20101118" (the additional spaces serve to hide the value ... " How do I add the additional spaces? If the spaces are to hide the value, what does it has to do with sorting the value (the date in string, the "PA" text, and blank).

I know you've explained it in a layman term but I just don't get it. Care to explain it further?

Anyway here is the code that I use:

 
Sub Querysave(Source As Notesuidocument, Continue As Variant)
  Dim doc As NotesDocument
  Set doc = source.Document
  Dim item As NotesItem
  Dim appvDate As String
  Dim pa As String
	
  ' Get approval date value
  Set item = doc.GetFirstItem("FRP_CustomerApprovalDate")
  appvDate = item.Text
	
  ' Get pending approval value
  Set item = doc.GetFirstItem("FRP_PendingApproval")
  pa = item.Text
	
  If(appvDate <> "") Then
    doc.FRP_CustomerApprovalDateText = Right$(appvDate,4) & "/"   & Left$(appvDate,2) & "/" & Mid$(appvDate,4,2)
  Elseif (pa = "1") Then
    doc.FRP_CustomerApprovalDateText = "PA"
  Else
    doc.FRP_CustomerApprovalDateText =""
  End If
End Sub

Open in new window

I just changed the code again...I just remember that if the user choose 'Pending Approval', the code needs to wipe out what's in Date Approved field.
 
If(appvDate <> "" & pa <> "1") Then
		doc.FRP_CustomerApprovalDateText = Right$(appvDate,4) & "/" & Left$(appvDate,2) & "/" & Mid$(appvDate,4,2)
Elseif (pa = "1") Then
	doc.FRP_CustomerApprovalDateText = "PA"
		doc.FRP_CustomerApprovalDate = ""
Else
	doc.FRP_CustomerApprovalDateText =""
End If

Open in new window


I changed the forms to accommodate this change
User generated image
ASKER CERTIFIED SOLUTION
Avatar of Sjef Bosman
Sjef Bosman
Flag of France image

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
sjef thanks for pointing out the mistake on the code. I haven't gotten a chance to try your other solution. another problem came up. here is the link to the question: https://www.experts-exchange.com/questions/26644876/Notes-error-Invalid-or-nonexistent-document-when-unlocking-a-document.html