Project and Line Items may each have an unlimited number of user-defined fields (UDFs), however four to five UDFs each is a good practical limit. These UDFs are added through the System Administration tool.
To reference these UDFs, a property is created on the root part with the same name as the System Name of the desired UDF. For example, a UDF named "Location" needs a corresponding read-only property on the root part named "Location".
Whenever the model is loaded, the Rulestream properties assigned to the Project/Line Item UDF fields (if they exist) will be initialized with the existing UDF values.
An alternate method to reference a Project UDF or Line Item UDF without placing a property on the top part of the application is to use the following syntax:
By design, Project UDFs cannot be modified while editing a model - only Line Item UDFs can be modified.
Setting a UDF Value
Result = Me.PathForJobFiles
If Result <> "" Then
CType(RootPart.Properties("myLIudf3"), PropertySF).InputValue = Result
Whenever you need to reference a UDF property it must be always referenced via the RootPart object as shown above.
To restrict the values allowed to be chosen in a UDF to a list use the TableName and FieldName settings of the UDF. They allow you to map choices from the given TableName's FieldName into a drop-down selection list.
Use a view on the DB to create a "virtual" table with one column to use here if you don't have all the choices in one column of one table currently. Using a view will execute a SQL query to get the list.
Using a LineItem UDF value to pass a Value to Release.bat
Using the UDF from above, assume that there are two Project UDFs and three LineItem UDFs.
The UDF values are passed to the Release.bat file’s command line. Since a third LI UDF is more than the %1 thru %9 command line arguments Rulestream can reference, use the shift command in the .bat file:
REM This file is executed as a part transmitting a lineitem.
REM The first 6 parameters to this file are 'Release' path,
REM Project ID, LineItemID, and Release ID, Release Type ID,
REM and UserID that did the Release, respectively.
REM The next 4 are UDF 1 thru 4 if they exist,
REM starting with Project UDFs, then LIUDFs
REM Below is a sample of how the arguments might be used to execute different commands.
REM This file is expected to be located in the Master Docs folder.
Echo Arguments passed in:
Echo %1 is the release directory
Echo %2 is the Project ID
Echo %3 is the lineitem ID
Echo %4 is the release ID
Echo %5 is the Release Type ID (from Release_Type table in ProjectDB)
Echo %6 is the UserID that did the Release
Echo %7 is the 1st UDF, starting with ProjectUDFs
Echo %8 is the 2nd UDF
Echo %9 is the 3rd UDF
REM To access arguments higher than (percent)9, you have to use the shift command
REM to shift the arguments one at a time to lower numbers.
REM For example, to get to the 10th argument, you would add the following:
REM shift /8
REM (percent)9 now contains the 10th argument
REM details are here:
Echo %9 is the 4th UDF
Echo %9 is the 5th UDF
REM Copy files from the Release folder to the folder specified in UDF5
Echo Preparing files for transfer from %1 to %9...
copy /Y "%1~\*" "%~9"
Echo File Transfer complete.
REM the ~ between the percent sign and the argument number removes any embedded double quote characters
REM @Echo On
REM Echo Executing the Released release.bat file...
REM "%~1GeneratedRelease.bat" %~1 %2 %3 %4 %7 %8 %9