ATC: TARGET tablename option

This command sets the Target table row for subsequent ATC: IF and ATC: SET commands.

  • tablename is required and denotes the table to be used (e.g. DocItem).
  • option is optional and can be any of the following in the order described:
    • BY sortfield  indicates the field in the table by which to sort. This option is recommended if more than one record may match your filter.
    • BY @ indicates that the DocItem or DocItemTask row that corresponds to the current row should be targeted
    • WITH filter; requires the semicolon (;) at the end. It specifies a filter for limiting the rows to those that match. Use .NET Data Expression syntax. Do not use [bookmark] references; use a variable, remember the semicolon! For more information see the Data Dictionary and .NET data expression syntax.

Notes: After the command, $$RowCount is set to the number of rows that matched.  TargetRow is set to the first row. The remaining rows are not accessible: see ATC: FOREACH.  ATC: TARGET DocRoute automatically limits the result to the current stage of the document route.

Examples

ATC: DUE 0 DAY 1 INTO $StartOn
ATC: DUE 365 DAY 1 -1 INTO $EndOn
ATC: TARGET DocDates WITH DocDateTypeKey = 'DED5B6FF-C747-4E96-AA4F-1A010E238214'
ATC: SET TargetRow.ActStart = $StartOn
ATC: SET TargetRow.ActFinish = $EndOn

The above example means “take the Due date and define $StartOn as the first day of the following month, then define $EndOn as the last day of the month in 1 year, then set the Target row to be the one with the Commitment Current Date type (expressed as the DocDateTypeKey GUID) in the DocDates table, and finally set the Start and Finish date fields on that row to the values in $StartOn and $EndOn, respectively.”

ATC: SET $Project = [DocHeader_Project]
ATC: FOREACH DocItemTask By ProjEntity WITH ISNULL(csString080,'') = '';
   ATC: SET $WBCode = @.ProjEntity
   ATC: SET $WBCDescr = LookupResult( ProjectTask, $WBCode, $Project)
   ATC: SET @.csString080 = $WBCDescr
   ATC: TARGET DocItem BY @
   ATC: SET @.Description = $WBCDescr
ATC: ENDLOOP

The above example means “store the project into a variable, then loop through the item tasks that have no value in csString080.  Grab the WBS code (from ProjEntity field) and resolve the description of the WBS line using the LookupResult function.  Store the description into csString080 and then find the corresponding Item row and set the description.  Note: this loop makes some sense for Production Units, but not for Change Items!

ATC: TARGET DocDates WITH DocDateTypeKey = 'fbccb57c-d5c9-4940-8861-401412ca937c'
ATC: IF TargetRow.ActFinish IsChanging
   ATC: SET $Start = TargetRow.ActStart
   ATC: SET $End = TargetRow.ActFinish
   ATC: SET $CDays = LookupResult( DaysBetween, $Start, $End)
   ATC: SET DocRevision.DaysRequested = $CDays
ATC: IF

The above example means “use Doc dates of a the Project Current type for the following: If the Finish date has changed, set variables to hold the Start and Finish dates and calculate how many days are in between those two dates, then fill in the Schedule Impact field with that number of days.”

ATC: TARGET DocRoute BY Sequence DESC WITH Sequence < 100 and ResponseCode in ('A','R');
ATC: IF NOT $$TargetRow IsEmpty 
   ATC: IF TargetRow.ResponseCode = A
       ATC: SET Status =  K
   ATC: ENDIF
   ATC: IF TargetRow.ResponseCode = R
       ATC: SET Status = J
       ATC: DISPATCH as Restart
   ATC: ENDIF
ATC: ELSE 
   ATC: * No route response found 
ATC: ENDIF

The above example means “find a route response prior to Sequence 100 (in the current stage) with a response code.  If one is found, use the last one (Sequence DESC).   Set the document status based upon the route response.  If the code is R, the route is restarted.


Last updated: September 5, 2024 at 13:26 pm; V2017+; green text = new