Workspaces to Learn "Define Field" Syntax
Learning how to write DEFINE FIELD syntax can be a challenging. This is particularly true because the syntax for DEFINE FIELDs is not captured in the LOG or other automated ways to capture SCRIPT syntax. Thus, at first glance one might think there is no way to obtain the syntax for DEFINE FIELDS.
This isn't a correct assessment. It is actually pretty easy with a workspace.
1) After creating the field using the ACLWizard, simply go over to the project navigator and right click on a folder and tell ACL that you want to create a new workspace. Then go into the new work space, a pop up box will appear asking you what fields you wish to add. When it does, simply select the new field(s) that you defined (per the directions "Working_days.") This will bring a modified version of the field defition into the workspace that will allow you to create other fields elsewhere. Save it and you are good to go.
A note on workspaces---fields created via workspaces are temporary and will disapear whenever you leave the table UNLESS you do something else permanent on the table (Eg modify an existing field/add a new field/etc.)
2) Next steps: Turn the workspace into a script. The format for a workspace is SIMILAR to that used in writing scripts. There are two key differences:
When you cut and paste a workspace field definition into a script, you need to add the words "DEFINE FIELD" to the workspace on the first line.
When you cut and past the workspace field definition into a script, you need to add a blank line between the first and second line.
3) Advanced Step: When you are feeling up to the challenge, you can start using dialogue boxes and writing the script so that it can be used on tables that may not use the same field names. For example, a "Take Command" article defining how to calculate working days assumes that the field names are "end_date" and "start_date." What if you were dealing with a file where you wanted to compare "received_date" and "process_date?" You'd have to manually modify the script to do so. ADVANCED users can write the script to request data input to point the script to specific fields. We would do so by:
1) Opening a script.
2) At the top we would select the button that reads "Build a New Dialog."
3) On the left select the button that reads "Project Item List"
4) When the pop up comes we'd go to the drop down where it says category and select "Date Fields." (We would probably rename the variable as well, but we'll leave it for now as the default of ITEM1.) We'd then select the "text" button and write something like "Select field with start date."
5) We'd repeat step 4 but this time the variable would be "ITEM2" and the text field would ask for the stop date.
6) When we'd then goto the script, that can again be obtained via a workspace (or advanced users might just write it out,) and substitute %ITEM1% where the instructions call for "start_date" and substitute %ITEM2% where the instructions call for end_date.