Solved

Problem with @FileSave

Posted on 2013-05-22
6
334 Views
Last Modified: 2013-12-18
Hi,

I'm trying to write a shared action in a Lotus Notes database. We will use this database for processing of expenses claims. In this case the action submits the expenses claim after first running through some validation checks on  certain fields.
What I want to do is save the document (so that my @Abstract gets calculated and I can count the amount of text in the justification field), apply the validation checks giving the option to Cancel and correct or Continue and then finally (assuming they choose "Continue") I update the status to Submitted and assign a reference number then save again.

Problem is that while the first save works the second one doesn't. If I take the first save out then the second one works fine. I have a vague memory that this is some sort of restriction but I can't remember the details.

Can anyone advise how to get round this or maybe a better way to do what I am trying.

I guess I could make my ' Notes' RTF a plain text field instead but that would mean I couldn't attach any receipts etc.

Thanks Andy

Current code is :

FIELD FullName := "";
FIELD CurrentNum := 0;
FIELD Prefix := "";

@Command([FileSave]);
FIELD saveoptions:="0";

@If(EFL_AmountPP > EFL_MaximumAmount; answer:=@Prompt([YesNo];"Outside Expense policy limits";"The meal cost per person is higher than allowed for in the expenses policy. You can either continue anyway or cancel and review the claim. Continue ??");"");
@If(answer=0; @Return(0); "");

@If(EFL_AdditionalNotesRequired = "Yes" & @Length(EFL_AdditionalNotesAsText) = 0; answer:=@Prompt([YesNo];"Justification Required";"This type of expense claim requires a justification to allow approval. The 'Notes' field appears to be empty. You can either continue anyway or cancel and review the claim. Continue ??");"");
@If(answer=0; @Return(0); "");

@If(@Adjust(EFL_Date;0;3;0;0;0;0) < @Now;  answer:=@Prompt([YesNo];"Historic Expenses Claim !";"The Expenses policy states that claims should be submitted within 3 months of being incurred. You can either continue anyway or cancel and review the claim. Continue ??");"");
@If(answer=0; @Return(0); "");


FIELD FullName := @Name([Canonicalize];@UserName);
FIELD ShortName := @Name([CN];@UserName);

FIELD seq_UNID := @DbLookup("":"NoCache";"":""; "Person_Lookup";FullName;3) ;
@If(
      @Length(seq_UNID)!=32;
      @Prompt([Ok];"Error";"Can't find an entry for you in the Employees view - please notify IT.");
      @Do(
                  @SetField("EFL_Status";"Submitted");
                  FIELD CurrentNum:= @GetDocField(seq_UNID;"ExpenseRef");
                  FIELD Prefix := @GetDocField(seq_UNID;"ExpensePrefix");
                  @SetField("EFL_Reference";Prefix+"-"+@Text(CurrentNum)) ;
                  @SetField("EFL_ExpenseManager"; @GetDocField(seq_UNID;"ExpenseManager"));
                  @SetDocField(seq_UNID; "ExpenseRef";CurrentNum+1)
                  )
      );
@Command([FileSave]);
FIELD saveoptions:="0";
@Command([FileCloseWindow])
0
Comment
Question by:andyhines
[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
  • 3
  • 2
6 Comments
 
LVL 46

Expert Comment

by:Sjef Bosman
ID: 39189525
Is any of the fields an Authors field? If the current author of the document is not in that field the first time the document is saved, he cannot save the document again, not being one of the authors. So the first time he has to be present, the full canonical name, and if you want to prevent updates once saved again, you have to remove the name before the second save. It might be easier just to add another Authors field that you remove right before the 2nd save.
0
 

Author Comment

by:andyhines
ID: 39190314
Hi. I do have an Authors field on the document but the code above doesn't touch it (yet)
It is populated with my full canonical name and the name of an Admin group.

I don't believe this is the fault because if I create a doc, enter a description, save it manually, update the description, save it again and then close it I do see the updated description.

Thanks - Andy
0
 
LVL 4

Accepted Solution

by:
QuinF earned 500 total points
ID: 39190655
Andy,
You perform a File Save, then you set Saveoptions = "0", then you try to save the document again.  It can't perform that save.  You need to set the saveoptions = "1" before your second save.
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:andyhines
ID: 39191750
Ahhhh ... I thought SaveOptions = 0 meant 'Save without prompting'. Guess I'd better read the documentation again. I'll try this in the morning. Thanks - Andy
0
 
LVL 46

Expert Comment

by:Sjef Bosman
ID: 39193514
Well spotted!
0
 

Author Closing Comment

by:andyhines
ID: 39193772
Many thanks.
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

I thought it will be a good idea to make a post as it will help in case someone else faces these issues. I trust this gives an idea how each entry in Notes.ini can mean a lot for the Domino Server to be functioning properly. This article discusses t…
Lack of Storage capacity is a common problem that exists in every field of life. Here we are taking the case of Lotus Notes Emails, as we all know that we are totally depend on e-communication i.e. Emails. This article is fully dedicated to resolvin…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …
This video shows how to use Hyena, from SystemTools Software, to update 100 user accounts from an external text file. View in 1080p for best video quality.

739 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