Solved

somehow one line of code is skipped

Posted on 2004-04-28
5
247 Views
Last Modified: 2013-12-18
Hi,
i include the following in the formula of a button.
rejectReason is a text field name where i have put a default value as " "
after i pressed on the button a mail is sent out
however the regHis field content is not updated, i.e. it keeps its original value.
there are no error message or error log at all.
Any cluse?
Thanks!!

@SetField("regHis"; "On " + @Text(@Now) + ", " + @Author + " wrote " + rejectReason);
@SetField("regStatus"; "On " + @Text(@Now) +",  " + @Author + " rejected.");
@MailSend(user1;user2;"";"Rejected" ;"";"Rejected.";[IncludeDoclink]);
@SetField("MAIL_SEND"; "Y");
@Command([FileSave]);
0
Comment
Question by:damoncwk
  • 3
5 Comments
 
LVL 15

Expert Comment

by:Bozzie4
ID: 10937374
Stop using @setfield.  It's only useful within loops (if you use R6) or within an @do structure (R5).  @setfield requires that the field already exist, and is the cause of a lot of problems, if you don't use it correctly.
Also watch out using the @author function.  It doesn't always returns the original author.  If you want it to be the name of the current user, use @username.

Try again :

FIELD regHis :=  "On " + @Text(@Now) + ", " + @name(]cn];@username) + " wrote " + rejectReason;
FIELD regStatus :=  "On " + @Text(@Now) +",  " + @name(]cn];@username) + " rejected.";
@MailSend(user1;user2;"";"Rejected" ;"";"Rejected.";[IncludeDoclink]);
FIELD MAIL_SEND :=  "Y";
@Command([FileSave])

cheers,

Tom
0
 
LVL 15

Expert Comment

by:Bozzie4
ID: 10937381
About @setfield : if you use R6, it should also work when the field doesn't exist yet, but it remains good practice to make sure it exists :

This is the correct way of using @setfield :

FIELD MyField := MyField;
...
@setfield("MyField";"some value");
...
0
 

Author Comment

by:damoncwk
ID: 10937467
Tom,
thanks for that.
However if I do not give any value to the rejectReason field
then the mail is still sent out.
What i am trying to achieve here is that i want to make
sure the rejectReason field is being filled with content
else the mail is not allowed to be sent.

Thanks!
0
 
LVL 15

Accepted Solution

by:
Bozzie4 earned 125 total points
ID: 10938674
Aha.  Add this first line.  This will stop executiong of the formula.

@if( rejectReason = ""; @return(@prompt([ok];"Warning";"You must enter a value for rejectReason")); "") ;
FIELD regHis :=  "On " + @Text(@Now) + ", " + @name(]cn];@username) + " wrote " + rejectReason;
FIELD regStatus :=  "On " + @Text(@Now) +",  " + @name(]cn];@username) + " rejected.";
@MailSend(user1;user2;"";"Rejected" ;"";"Rejected.";[IncludeDoclink]);
FIELD MAIL_SEND :=  "Y";
@Command([FileSave])

Also use the Input Validation formula for rejectReason (Something should be a status or something :  eg. status = "rejected" ):

@if( Something & @trim(rejectReason) = ""; @failure(" please give a reason" ) ; @success )
0
 
LVL 24

Expert Comment

by:HemanthaKumar
ID: 10938887
Try this

@SetField("regHis"; "On " + @Text(@Now) + ", " + @Author + " wrote " + rejectReason);

@SetField("regStatus"; "On " + @Text(@Now) +",  " + @Author + " rejected.");

@MailSend(user1;user2;"";"Rejected" ;"";"Rejected.";[IncludeDoclink]);

@SetField("MAIL_SEND"; "Y");

@PostedCommand([FileSave]);

~Hemanth
0

Featured Post

U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

Question has a verified solution.

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

For users on the Lotus Notes 8 Standard client, this article provides information on checking the Java Heap size and adjusting it to half of your system RAM in attempt to get the Lotus Notes 8.x Standard client to run faster.  I've had to exercise t…
For beginners of Lotus Notes user this is important to know about the types of files and their location supported by IBM Notes. Mostly users are unaware about how many file types are created and what their usages are. This Article is fully dedicated…
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…

832 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