Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

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

Simple Lotus If Statement

I'm relatively new to Lotus Notes, how do I write an if statement so that is one field equal y then the other field is populated by today's date?  I need to get this done immediately, so I assure you that I will give you 500 points and an A.
0
christie_holtz
Asked:
christie_holtz
  • 9
  • 8
  • 7
2 Solutions
 
Sjef BosmanGroupware ConsultantCommented:
An IF in what language? Formula, LotusScript, Java or JavaScript?

Assuming Formula, and that otherfield is Computed, with value otherfield:
    @If(onefield="y"; @Setfield("otherfield"; Today); "")
0
 
Sjef BosmanGroupware ConsultantCommented:
It depends on where and when you want set the value. So if you could give some additional info...
0
 
christie_holtzAuthor Commented:
There are two fields.  One is confirmed (which is a yes/no).  And the other is date confirmed.  I want date confirmed to automatically populate to be today's date.  I'm using Designer and am assuming that this goes as the default value for date confirmed?  Should it go somewhere else?
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.

 
christie_holtzAuthor Commented:
I put this in the default value section for DateConfirmed.  there were no errors, but it did not work.  Do i put is somewhere else.  Possibly in the ZeroBundleConfirmed Section?
@If(ZeroBundleConfirmed="y"; @Setfield("DateConfirmed"; Today); "")
0
 
Sjef BosmanGroupware ConsultantCommented:
The default value for a field is used only when a new document is created. So if you want to set a field at a later stage, you need to set it differently. I assume you don't want users to manually change the date_confirmed field, so it should be a Computed field, with a value like this:
    @If(confirmed="y" & !IsTime(date_confirmed); @Today; date_confirmed)

Which means: if the value of the field 'confirmed' is 'y' and the field date_confirmed (i.e. this field) is not a time value, then use the current date, else replace this field with this field.

And sorry, I had a typo in my first post: it should be @Today, it's a function in Formula language.
0
 
christie_holtzAuthor Commented:
I'm getting an error when i put in @If(ZeroBundleConfirmed="y" & !IsTime(dateconfirmed); @Today; dateconfirmed)

It says @FunctionOperator expected  or @ Function does not require argument : ')'
0
 
Sjef BosmanGroupware ConsultantCommented:
Triple @%$#%! Another typo (it's not my day), also IsTime is a Formula function, it should be @IsTime...
0
 
p_parthaCommented:
@If(ZeroBundleConfirmed="y"; @today;DateConfirmed)

Partha
0
 
Sjef BosmanGroupware ConsultantCommented:
Hey Partha! Go to work, bro.

Not good anyway, because if one saves the document a second time, the DateConfirmed will be overwritten.
0
 
p_parthaCommented:
HI Bro

Thx for the advice :), It all depends on whether the field is computed for display or composed and his logic though !

partha

0
 
Sjef BosmanGroupware ConsultantCommented:
Do we agree that we disagree? ;)
0
 
christie_holtzAuthor Commented:
Ok..I did this and it worked : @If(ZeroBundleConfirmed="Yes"; @Today; DateConfirmed)

However, now I have to update an agent.  The code is as below

FIELD ZeroBundleConfirmed := ZeroBundleConfirmed;
@If(Except="Yes";@Prompt([Ok];"Error";"This Bundle can not be confirmed because the 'Does an exception need to be filed for this bundle?' field equals Yes.");@SetField("ZeroBundleConfirmed"; "Yes"));SELECT @All

I want to updated the DateConfirmed equal to today's date when the ZeroBundleConfirmed is set to yes.  

0
 
christie_holtzAuthor Commented:
Again, I vow 500 points and an A
0
 
p_parthaCommented:
@If(ZeroBundleConfirmed="Yes"; @Today; DateConfirmed), this line does that only

Partha
0
 
p_parthaCommented:
give like htis:

field dateconfirmed:=@If(ZeroBundleConfirmed="Yes"; @Today; DateConfirmed);dateconfirmed
0
 
Sjef BosmanGroupware ConsultantCommented:
Don't forget to check if the document was already confirmed, with the code above you will overwrite the original confirmation date! That's why I used @IsTime
0
 
christie_holtzAuthor Commented:
So i can just put the field statement at the beginning?
0
 
christie_holtzAuthor Commented:
Since you both are being so helpful, i'll post this question again and ask one of you to respond with the same answer.  that way I  can give you both 500 points and an A.
0
 
p_parthaCommented:
You can split the points,
As sjef was first, please give him take the lion's share

Partha
0
 
p_parthaCommented:
typo "As sjef was first, please give him the lion's share " 

:)

Partha
0
 
christie_holtzAuthor Commented:
I'll do whatever makes ya'll happy.  You've both been so helpful I just wanted to make sure you both got a bunch of points.
0
 
christie_holtzAuthor Commented:
Any thoughts on the agent?
0
 
p_parthaCommented:
THe line i gave :
field dateconfirmed:=@If(ZeroBundleConfirmed="Yes"; @Today; DateConfirmed);

can  be added in the agent only

Partha
0
 
Sjef BosmanGroupware ConsultantCommented:
Thanks! :) And don't forget to protect DateConfirmed against overwriting (e.g. using the @IsTime function)...
0

Featured Post

Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

  • 9
  • 8
  • 7
Tackle projects and never again get stuck behind a technical roadblock.
Join Now