0
votes

I have a button use to save document. This button only visible in edit mode only. I have 4 option to save a document which awere "Save As Draft", "Save PC Inspection", "Save New Version", and "Save Write Off". Below is the figure:

save

For "Save As Draft", "Save PC Inspection", and "Save New Version", I'm using same document form while "Save Write Off" I'm using different document form with different view which is Draft, Write Off, and Computer.

My problem now is when I open in edit mode, the save button show all. What I'm try to achieve are:

  1. When I'm on Computer view and open document in edit mode, I only want to show "Save As Draft" and "Save New Version" only.
  2. When I'm on Draft view and open document in edit mode, I only want to show "Save As Draft" and "Save PC Inspection" only.
  3. Lastly, when I'm on Write Off view and open document in edit mode, I only want to show "Save Write Off" only

How can I show save button only when document open in edit mode for specific document view? Any advice or help I appreciate!

1

1 Answers

3
votes

Just use the same formula that you use in the selection of your views in the Hide- When- Formula of the buttons.

If the selection formula for the view "Draft" is something like:

SELECT Form = "SomeForm" & Status = "Draft"

then you use this formula on the hide- when of the "Save as Draft"- Button:

Status != "Draft"

and if that was the only condition you would use this one on all other save- Buttons:

Status = "Draft"

Your example would translate in the following hide- when- Formulas (taken that there is a Status- field that is used for view selection):

All Hide- Whens:

Save As Draft- Button:

!(Status = "Draft" : "Computer")

Save New Version- Button:

!(Status = "Computer)

or Status != "Computer"

Save PC Inspection- Button:

Status != "Draft"

Save Write Off- Button:

Status != "Write Off"

EDIT: Response to your Comment

The formula from your comment is:

SELECT Form = "Computer" & 
  (PFStatus = "Not Found" | PFStatus = "Obsolete" | PFStatus = "Spoilt") & 
  PStatus != "Write Off"

This formula is way to complicated. If PFStatus is a single value and not multivalue field, then the formula can be condensed to:

SELECT Form = "Computer" & PFStatus = "Not Found" : "Obsolete" : "Spoilt"

The negation at the end can be omitted, it does not add anything. SO if you want to hide a Button if the document does NOT come from this view, then the hide when would be: Just negate the condition:

!(PFStatus = "Not Found" : "Obsolete" : "Spoilt")