PSEC - Powershell Enhanced Capability
Version 1.2.1

Task Execute for: Showcase Contexter

Properties

Implemented Functions

getTaskDesc Function Meta

Example

set context with cycleNo and month

Keywords

context

Description
 This runs after the *params* function

    function getTaskDesc([Task]$task) {
      [string]$desc        = @"
This illustrates how to manage the global workflow context for subsequent tasks.
"@
      return $desc;
    }

primeContextTask Function Meta

Example

set parameters with current date

Keywords

context

Description
The *brief* variable is set so that the *primeContextTask* has access to it.


    function primeContextTask([Task]$task, [hashtable]$brief) {
      $tfs = $task.tfs;
      $tfs.globMap.demoGlobs.cycleNo = 0;
      if (exists $brief cycleNo) {
        $tfs.globMap.demoGlobs.cycleNo = $brief.cycleNo / 1;
      }
      if (exists $brief month) {
        $tfs.globMap.demoGlobs.month = $brief.month;
      }
      hlogBoth("Running primeContextTask $($task.name) $($tfs.globMap.demoGlobs.month) $($tfs.globMap.demoGlobs.cycleNo) $($brief.cycleNo)")
      [void]($task.find("opt-cycleNo").setText("$($tfs.globMap.demoGlobs.cycleNo)"));
    }

params Function Meta

Example

set options with month and starting cycleNo

Keywords

context

Description
This runs before the *params* function and the values set here are passed to it.


      function params {
        param([Object]$task,[hashtable]$htOpts)
        $tfs = $task.tfs;
        $date = Get-Date
        [string]$dateStr = $date.ToString("yyyyMMdd")

        $htOpts.datestr = $dateStr;
        $htOpts.brief   = "$($task.statlocn)"
        return  $htOpts
      }

options Function Meta

Example

run context script

Keywords

context

Description
This example increases the `cycleNo` whenever the *runScript* function is run.


      function options {
        param([Object]$task)
        $opts = @();
        $tfs = $task.tfs;
        $opts += @{type='input';  parm="cycleNo"; label='CycleNo';  place='cycloNo'; readonly=$true}
        $opts += @{type='combo';  parm='month';   label='Month';   valset='jan,feb,mar,apr,may,jun,jul,aug,sep,oct,nov,dec'}
        hlogBoth("fetch.options $($tfs.globMap.demoGlobs.month) $($tfs.globMap.demoGlobs.cycleNo)")
        return  ,$opts
      }

runScript Function Meta

Example

run context script

Keywords

context

Description
This example increases the `cycleNo` whenever the *runScript* function is run.


      function runScript([Task]$task, [hashtable]$parms, [hashtable]$status) {
        $tfs = $task.tfs;
        $status.month = $tfs.globMap.demoGlobs.month = $parms.month;
        $status.cycleNo = $tfs.globMap.demoGlobs.cycleNo = $tfs.globMap.demoGlobs.cycleNo + 1;
        hlogBoth("Running script $($task.name) $($tfs.globMap.demoGlobs.month) $($tfs.globMap.demoGlobs.cycleNo)")
        [void]($task.find("opt-cycleNo").setText("$($tfs.globMap.demoGlobs.cycleNo)"));
      }

PSEC - Powershell Enhanced Capability
1.2.1

Copyright © 2018-2021, 2022, Rexcel System Inc.

 

 

 

 

 

X