Have you ever had to use a hide when formula that goes something like: Status = "In Progress" | Status = "Approved" | Status = "Awaiting Approval" | Status = "Under Review"
I built an application with which we manage all our IT work. In this application a document can have any one of 14 statuses:
- Assigned to BA
- Pending Business Resource
- Requirements in Progress
- Requirements Awaiting Signoff
- Requirements Complete
- Estimate Pending
- Estimate Complete
- Development Scheduled
- Development in Progress
- BA Testing
- User Test/Acceptance
As you can see from the list of statuses they are progressive, i.e. a document moves through these statuses as the work progresses. On the form, various fields are editable only at certain statuses and computed for display at others becuase we didn't want, for example, specifications changed after estimates had been given. As you can imagine, view selection fomulas and hide when formulas on fields and action buttons started to get out of hand.
To make things worse, while we were developing and testing this application, statuses have been added and removed and yes it was also in production! A change in status resulted in over 120 changes to hide when formulas and view selection formulas!
There had to be an easier way...
This is the solution I came up with:
- Put the statuses in a field on a profile document, field is called kwStatus, the field is text, allow multi values, separate entries with a new line.
- On the form create an editable field with the following formula: @Explode(@GetProfileField("profile";"kwStatus") ; @NewLine)
- On the form create a computed number field called StatusNumber with the follwoing formula: @Member(kwStatus; @Explode(@GetProfileField("profile";"kwStatus");@NewLine))
What happens now is that the StatusNumber field is set to the number that corresponds to the list position of the document status in the list in the profile document. For example, Estimate Pending gives a Status Number of 6.
Hide when formulas on fields and Action buttons and view selection formulas can now be written as hide StatusNumber >6 & StatusNumber < 10
To take this further. The first 5 Statuses: Assigned to BA Pending Business Resource Requirements in Progress Requirements Awaiting Signoff Requirements Complete are all about the specifications and are dealt with by the Business Analysts. The next 4 Statuses: Estimate Pending Estimate Complete Development Scheduled Development in Progress are all dealt with by the Developers. This lead to the me creating 2 new fields on the form: 1. Field is called IsAtSpecStage, and is a computed number field with the formula: @If(StatusNumber < 6; 1;0) 2. Field is called IsAtDevStage, and is a computed number field with the formula: @If(StatusNumber > 5 & StatusNumber < 10 ; 1;0) View selection formulas then become: Form = "Maintenance Request" & IsAtDevStage. This is makes the views much faster to open. NOTE: The above tip is relevant to any keyword fields that relates some sort of