[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
Solved

Setting a field value from radio button/field

Posted on 2012-04-03
11
Medium Priority
?
1,593 Views
Last Modified: 2013-12-18
I have form for each associate.  While they are employeed, they are Active.  Once they terminate there is a radial button that the supervisor changes the status to Terminated and the Term_Date field is unhidden for them to put a term date in.

Some associates will term with the company and then come back.  I am stuck how to do the following,  When the supervisor changes the status back to Active I wanted it to set the value in the Term_Date field to NULL and also change the main_status field back to Achive from Archive.

I have tried the following on the On Exit Event, but it is not working.

Sub Exiting(Source As Field)
      Set s = New NotesSession
      Set db = s.CurrentDatabase
      Set ws = New NotesUIWorkspace
      
      Set uidoc = ws.CurrentDocument
      Set doc = uidoc.Document
      
      Dim session As New NotesSession
            
      If doc.Emp_Status(0) = "Term" Then
            doc.main_Status = "Archive"
            
            If doc.Emp_Status(0) = "Active" Then
                  doc.Term_Date = ""
                  doc.main_Status = "Active"
                  
            End If
      End If
      
      Call uidoc.Refresh
      
End Sub
0
Comment
Question by:kali958
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 6
  • 5
11 Comments
 
LVL 17

Expert Comment

by:fgrushevsky
ID: 37802573
Based on what you described, the Term_Date field is a date/time field, therefore doc.Term_Date = "" would not work
instead you will need something likek this

Dim termd As NotesItem
      
....

Set termd = doc.GetFirstItem("Term_Date")

Set termd .DateTimeValue = Null
0
 

Author Comment

by:kali958
ID: 37802770
I understand that in regards to the date, but none of the code is working and there are no errors to debug.
0
 
LVL 17

Accepted Solution

by:
fgrushevsky earned 2000 total points
ID: 37803345
you can do it simplier, I think.

You are using radio button Status. Make sure that "Refresh fields on keyword change" is selected on the second tab of field properties.

Make field Main_Status computed with a formula If (Status="active";"active";"archived") - or similar depending on your statuses.

for the Term_Date, do the following
in the queryrecalc event, add following code

If Source.FieldGetText("Status")="Active" Then
            Call Source.FieldClear("Term_Date")
End If
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 

Author Comment

by:kali958
ID: 37805812
I had to make sure that "Run Exiting/OnChange events after value change" was enabled.

Here is what finally worked:

Dim ws As New NotesUIworkspace
      Dim uidoc As NotesUIDocument
      Set uidoc=ws.currentdocument
      Dim doc As NotesDocument
      Set doc=uidoc.document
      
      If doc.Emp_Status(0) ="Active" Then
            Call uidoc.fieldsettext("Term_Date","")
            Call uidoc.fieldsettext("main_Status","Active")
      End If
      
      If doc.Emp_Status(0) = "Term" And doc.main_Status(0) = "Active" Then
            Call uidoc.FieldSetText("main_Status","Archive")
      End If
0
 
LVL 17

Expert Comment

by:fgrushevsky
ID: 37806288
Again, you don't need to use exiting event . It is not reliable as user can save and close the form without leaving the field.

However, "Refresh fields on keyword change" would always trigger Queryrecalc event when user changes value in radio-button
0
 

Author Comment

by:kali958
ID: 37806319
I do have the refresh Fields on Keywords selected. The field is also required, the Term_Date if they change the status to Term.
0
 
LVL 17

Expert Comment

by:fgrushevsky
ID: 37806338
ok, if you have " refresh Fields on Keywords selected", why don't you use Form Queryrecalc event ?
0
 

Author Comment

by:kali958
ID: 37806376
Lotus help says:

Occurs just before the current document is recalculated (before all the formulas on the document execute).

Wouldnt that mean that this happens before they change the value from Active to Term?
0
 
LVL 17

Expert Comment

by:fgrushevsky
ID: 37806549
No, it does not. Why would it happen before the value changes? What would trigger it?

Here how it works.
User changes the value in a keyword field (radio button).
If " refresh Fields on Keywords selected" is selected on the field,  then Querycalc event is triggered.
The trigger is the change of the value.
0
 

Author Comment

by:kali958
ID: 37807057
Well I can only go off the lotus help, that is why I asked my question out here on EE.

Right now I have it working on Exit.  I do not use lotusscript very often and this was a database I inherited.  I can try it on the QueryCalc.
0
 

Author Closing Comment

by:kali958
ID: 37807901
Tried both, my solution onExit and this one on Queryrecalc, both are successful.
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

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.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

  In today’s Arena we can’t imagine our lives without Internet as we are highly used to of it. If we consider our life style just for only 2 min we found that face to face communication is swapped by e-communication.  Every Where from Works place to…
Article by: Rob
Notes 8.5 Archiving Steps and Tips This article covers setting up a Notes archive, and helps understand some of the menu choices making setting up and maintaining a Notes archive file easier.
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…

650 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question