Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Problem with @FileSave

Posted on 2013-05-22
6
Medium Priority
?
344 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 2000 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
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: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

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

Question has a verified solution.

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

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…
Sometimes clients can lose connectivity with the Lotus Notes Domino Server, but there's not always an obvious answer as to why it happens.   Read this article to follow one of the first experiences I had with Lotus Notes on a client's machine, my…
This course is ideal for IT System Administrators working with VMware vSphere and its associated products in their company infrastructure. This course teaches you how to install and maintain this virtualization technology to store data, prevent vuln…
Want to learn how to record your desktop screen without having to use an outside camera. Click on this video and learn how to use the cool google extension called "Screencastify"! Step 1: Open a new google tab Step 2: Go to the left hand upper corn…
Suggested Courses

636 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