www softwaretoolhouse com Meta-Update Training Scripting 101 This

Скачать презентацию www softwaretoolhouse com Meta-Update Training Scripting 101 This Скачать презентацию www softwaretoolhouse com Meta-Update Training Scripting 101 This

f6d443b37ba40cb5dbaed7ab6641af39.ppt

  • Количество слайдов: 95

www. softwaretoolhouse. com Meta-Update Training Scripting 101 This presentation will introduce every element of www. softwaretoolhouse. com Meta-Update Training Scripting 101 This presentation will introduce every element of Meta-Update scripting. After completing this presentation, you should be well on your way to creating your own scripts. The Meta-Update User’s Guide should be referenced when needed. Software Tool House Inc. Ben Chernys 2010 -May-27

Agenda Objectives www. softwaretoolhouse. com A First View of Meta-Update Scripting Running Meta-Update Main Agenda Objectives www. softwaretoolhouse. com A First View of Meta-Update Scripting Running Meta-Update Main and Read Server Sections Control Sections File and Field Sections Assignment Sections Lookup Sections Samples

Agenda Objectives www. softwaretoolhouse. com A First View of Meta-Update Scripting Running Meta-Update Main Agenda Objectives www. softwaretoolhouse. com A First View of Meta-Update Scripting Running Meta-Update Main and Read Server Sections Control Sections File and Field Sections Assignment Sections Lookup Sections Samples

Agenda Objectives www. softwaretoolhouse. com A First View of Meta-Update Scripting Running Meta-Update Images Agenda Objectives www. softwaretoolhouse. com A First View of Meta-Update Scripting Running Meta-Update Images of Meta-Update Scripts Main and Read Server Sections Script Syntax — Sectioned “ini” files Control Sections Types of Sections File and Field Sections References Assignment Sections Predefined Lookup Sections Tags Samples

First View www. softwaretoolhouse. com A Simple Script This script resets the Recon. Id First View www. softwaretoolhouse. com A Simple Script This script resets the Recon. Id for all CIs in the passed Dataset ID.

First View www. softwaretoolhouse. com An Output Script This script creates a report of First View www. softwaretoolhouse. com An Output Script This script creates a report of the ARS Server Information.

First View www. softwaretoolhouse. com Scripts A script is an ASCII “ini” file containing First View www. softwaretoolhouse. com Scripts A script is an ASCII “ini” file containing sections and keywords. Ø Comment lines start with “#” and are ignored. Ø Section name have the form: [section] Ø Statements have the form: keyword = value Ø All section names, keywords, values are case-sensitive. Ø Lines can be long or continued with an ampersand “&” for readability. Ø The backslash is an escape character.

First View Section Types www. softwaretoolhouse. com There are different types of sections: Main First View Section Types www. softwaretoolhouse. com There are different types of sections: Main Read Server Control File and Field Assignment Look Up • • Server authentication & timeouts Script arguments and usage Id Log Read Servers • Server authentication & timeouts • Tag • • • File and field declarations Field interpretations • • • Targeted Untargeted Pattern Lists Queries Files Iteration: Query, Query. Sql, File, Loop Update, Create, Output Assignment Sections Launches

First View www. softwaretoolhouse. com References • ARS: • Meta-Update: $Field$ $Tag, Field$ Meta-Update First View www. softwaretoolhouse. com References • ARS: • Meta-Update: $Field$ $Tag, Field$ Meta-Update extends the concept of a reference by specifying a record with a field. This allows multiple records’ field values to be referenced.

First View References www. softwaretoolhouse. com • ARS: • Meta-Update: $Field$ $Tag, Field$ Tag First View References www. softwaretoolhouse. com • ARS: • Meta-Update: $Field$ $Tag, Field$ Tag Field an ARS record an ARS field’s database name or id a field of a file or SQL query a file record an SQL row a named variable set a diary entry program arguments the environment a program argument an environment variable an assigned string variable name a regular expression extract

First View www. softwaretoolhouse. com References • ARS: • Meta-Update: $Field$ $Tag, Field$ Meta-Update First View www. softwaretoolhouse. com References • ARS: • Meta-Update: $Field$ $Tag, Field$ Meta-Update allows you to process and retain in memory an unlimited number of records from different ARS forms, SQL queries, CSV files, and variable sets, at the same time, and use any of these data in your assignments.

First View www. softwaretoolhouse. com Predefined Tags Ø CTL Ø AR_INFO Ø ENV Ø First View www. softwaretoolhouse. com Predefined Tags Ø CTL Ø AR_INFO Ø ENV Ø Arg Script information Server information Environment variables Script arguments

Agenda Objectives www. softwaretoolhouse. com A First View of Meta-Update Scripting Running Meta-Update Main Agenda Objectives www. softwaretoolhouse. com A First View of Meta-Update Scripting Running Meta-Update Main and Read Server Sections Control Sections File and Field Sections Assignment Sections Lookup Sections Samples

Agenda www. softwaretoolhouse. com Objectives A First View of Meta-Update Scripting Running Meta-Update Main Agenda www. softwaretoolhouse. com Objectives A First View of Meta-Update Scripting Running Meta-Update Main and Read Server Sections Recommended utilities Control Sections Setting up a Command Prompt File and Field Sections The Sth. Lic. cmd batch command Assignment Sections Running binaries Lookup Sections Important switches Samples Other Software Tool House tools

Running www. softwaretoolhouse. com Recommended Utilities Ø cygwin – Highly recommended especially for handling Running www. softwaretoolhouse. com Recommended Utilities Ø cygwin – Highly recommended especially for handling large files, logs. – UNIX command line utilities for Windows. – Open source, binary download. – www. cygwin. com Ø A good ASCII editor – Can use Word or Notepad but not recommended and difficult to use. – Many free ones available: notepad++ recommended.

Running www. softwaretoolhouse. com Ideal Command Prompt Settings Adjust Properties of a Command Prompt Running www. softwaretoolhouse. com Ideal Command Prompt Settings Adjust Properties of a Command Prompt Ø Increase Buffer Width and Depth

Running www. softwaretoolhouse. com Ideal Command Prompt Settings Adjust Properties of a Command Prompt Running www. softwaretoolhouse. com Ideal Command Prompt Settings Adjust Properties of a Command Prompt Ø Turn on Quick Edit Mode

Running www. softwaretoolhouse. com Ideal Command Prompt Settings Running www. softwaretoolhouse. com Ideal Command Prompt Settings

Running Initialize Command Prompt www. softwaretoolhouse. com Ø Set PATH path D: AppsSTHbin; %path% Running Initialize Command Prompt www. softwaretoolhouse. com Ø Set PATH path D: AppsSTHbin; %path% export PATH=/apps/STH/bin: $PATH export LD_LIBRARY_PATH=/apps/STH/bin: $LD_LIBRARY_PATH

Running Initialize Command Prompt www. softwaretoolhouse. com Ø Set Meta-Update license, server connectivity environment Running Initialize Command Prompt www. softwaretoolhouse. com Ø Set Meta-Update license, server connectivity environment variables set set set Ars. Svr=localhost Ars. Port=0 Ars. Usr=Demo Ars. Pwd=Sth. Mupd. Lic=Xxxx-Xxxx When scripts (samples) use references like: $ENV, Ars. Svr$ Can be in script or on server form.

Running www. softwaretoolhouse. com Running Binaries Ø Runs in a Command Prompt or UNIX Running www. softwaretoolhouse. com Running Binaries Ø Runs in a Command Prompt or UNIX shell (or as a spawned process). Ø All Software Tool House binaries give usage information when run with no arguments. Ø All Software Tool House binaries return 0 on successful completion.

Running www. softwaretoolhouse. com The Sth. Lic. cmd e: Dta> Sth. Lic Must be Running www. softwaretoolhouse. com The Sth. Lic. cmd e: Dta> Sth. Lic Must be edited by the customer to specify server authentication and port. . . Usage: . . Sth. Lic. cmd svr. where svr is one of: dev 1, dev 2, prod 1. . Function: . sets the appropriate license environment variables. for Meta-Update, Meta-Schema, Meta-Query. e: Dta> Sth. Lic dev 1. Ars. Svr set to sthv 1. softwaretoolhouse. com. e: Dta>

Running www. softwaretoolhouse. com Sth. Mupd. exe Ø Meta-Update binary Ø Supply script name Running www. softwaretoolhouse. com Sth. Mupd. exe Ø Meta-Update binary Ø Supply script name and entry section Ø Two versions: local trace and global trace Ø Appends to Sth. Mupd. log Sth. Mupd. exe [switches] script_file script_section –p arg 1 arg 2. . .

Running www. softwaretoolhouse. com Meta-Update Version 4. 80 for ARS lib 7. 0 (c) Running www. softwaretoolhouse. com Meta-Update Version 4. 80 for ARS lib 7. 0 (c) Copyright 1996 -2010 by Software Tool House Inc. www. softwaretoolhouse. com Function: Sth. Mupd will process the Meta-Update script commands from the specified script file, and update or create ARS records based on input files or queries as specified in the script. Synopsis: Sth. Mupd [ -d [: x[, [y][, f]] ] [ -n ] [ -q ] [ -e ] [ -v ] [ -g ] script-file section [ Ar. Svr Ar. Usr Ar. Pwd [ Ar. Port ] [ -p [ Prm 001 [ Prm 002 [ Prm 003. . ] ] where: -d specifies the tracing level(s) -d specifies full tracing with no ARS tracing -d: x, y, f x specifies tracing levels (fdp 2 as) y ARS client tracing flags (fsap) f is the tracing file name (local or global) Warning: produces large output and slows throughput. -q Quiet: inhibit all output to stdout -g Debug Mode: will enter the script debugger -e single Error: job terminates when any error is encountered used more when developing script -v Verbose: simply turns on all echo trace levels; same as -d: iqgp -n is null operation, no update is performed (for testing) script-file is the Meta-Update script file to process section the first command section to process in the script file Ar. Svr ARS Server name or ip Ar. Usr ARS User name Ar. Pwd Password for User Ar. Port for Server -p place marker; all following arguments are defined Prm 001 and used within the script. Prm 002 Prm 003

Running www. softwaretoolhouse. com Meta-Update 155234. 109 155234. 750 155234. 765 155234. 953 155234. Running www. softwaretoolhouse. com Meta-Update 155234. 109 155234. 750 155234. 765 155234. 953 155234. 968 155234. 984 Version 4. 80 for ARS lib 7. 0 (c) Copyright 1996 -2010 by Software Tool House Inc. www. softwaretoolhouse. com i [Load] Fle: rec 1: "f 0 1", "f 1 ""1""-x", "f 2 1" i [Load] Fle: rec 1: Added to schema: _Test, Id: _Test 0000000145 i [Load] Fle: rec 2: "f 0 ""2""-x", "f 1 2", "f 2 2" i [Load] Fle: rec 2: Added to schema: _Test, Id: _Test 0000000146 i [Load] Fle: rec 2: Ff. Df. Get: eof on xx. x; 2 records read + 1 st field record i [Load] Fle: eof 2 records OK; 0 records with errors; total: 2 plus 0 spanned lines and 0 null lines. i Statistics: i Sections: 1 i Maximum section depth: 1 i Assignment Sections: 2 i File Sections: 1 i File Records: 2 errors: 0 i Output Schema records: 2 created i Output Schema records: 0 updated (with 0 skipped) i Outputs OK: 2 i Outputs Errors: 0 i Outputs Aborts: 0 i Input Errors: 0 i terminating successfully in 2 sec.

Running www. softwaretoolhouse. com Meta-Update Switches -esingle error mode: Job stops after any single Running www. softwaretoolhouse. com Meta-Update Switches -esingle error mode: Job stops after any single error. Use when developing. -d full Meta-Update logging -d: , fsa full logging plus server logging: filter, SQL, API -vmore verbose -g Meta-Update debugger

Running www. softwaretoolhouse. com Other STH Utilities Ø Sth. Mqry – Command line query Running www. softwaretoolhouse. com Other STH Utilities Ø Sth. Mqry – Command line query tool. Issues SQL and ARS Queries, can format results into CSVs. No hidden fields. Ø Sth. Mdel – Command line ARS record delete tool. Will delete records for a given table and query.

Running www. softwaretoolhouse. com Other STH Utilities Ø Sth. Msch – Command line schema Running www. softwaretoolhouse. com Other STH Utilities Ø Sth. Msch – Command line schema tool. Declares fields and field attributes of schemas. Can generate CSVs. Ø Diary Editor – A notepad like utility for editing Diary field contents.

www. softwaretoolhouse. com Command Line Query Escaping Running Ø All Queries entered on the www. softwaretoolhouse. com Command Line Query Escaping Running Ø All Queries entered on the command line must conform to ARS Query syntax and must be handled by the cmd. exe shell. Ø Queries use field Labels, field names, and field IDs between single quotes. Ø Windows Command box escape: ^ Ø General escape:

Running www. softwaretoolhouse. com Sth. Mqry Ø Used to execute an ARS or SQL Running www. softwaretoolhouse. com Sth. Mqry Ø Used to execute an ARS or SQL queries Ø Will output query results to stdout as text or as CSV Ø All hidden fields displayed; Quick CSV generator for Excel record comparisons or diffs Ø Query qualification can use field database names Ø ARS dates formatted, new lines replaced with ‘n’

Running Sth. Mqry www. softwaretoolhouse. com • • • Sth. Mqry ver 2. 7 Running Sth. Mqry www. softwaretoolhouse. com • • • Sth. Mqry ver 2. 7 for ARS 6. 0 (c) copyright 1996 -2008 by Software Tool House Inc. www. softwaretoolhouse. com Function: Issues an ARS or SQL query against a Remedy Server. • • • Usage Sth. Mqry. exe [-pncd ] Sth. Mqry. exe [-pncdq] • • • • where: -d -c -n -p -f -q Ar. Svr Port Ar. User Ar. Pwd Ar. Sch Qry Ar. Svr [ Port ] Ar. Usr Ar. Pwd Ar. Sch [Qry] SQL-Qry debug level tracing turned on just print the count of records matched just print the Query Result strings of matches; records not retrieved the Port parameter is supplied may be used with -c, -n output is a CSV (written to stdout) the supplied query is a direct SQL statement (-s invalid; do not specify a Schema) the Remedy server to connect to the Remedy server port to connect on the User id for the Remedy Server the Password for the Remedy Server; use '-' for no pwd the Schema to retrieve a query string (as per the Remedy user tool) if missing, returns all records

Running www. softwaretoolhouse. com Sth. Mqry • Sth. Mqry –q –p %Ars. Port% %Ars. Running www. softwaretoolhouse. com Sth. Mqry • Sth. Mqry –q –p %Ars. Port% %Ars. Svr% %Ars. Usr% %Ars. Pwd% select name from arschema where schemaid = 142 • Sth. Mqry –f –p %Ars. Port% %Ars. Svr% %Ars. Usr% %Ars. Pwd% STH: STH_Equipment “‘Asset ID’ = ”Test. 100”” > bs_test 100. csv

Running www. softwaretoolhouse. com Sth. Mdel Ø Used to delete ARS records by ID Running www. softwaretoolhouse. com Sth. Mdel Ø Used to delete ARS records by ID or by Query Ø Run Sth. Mqry first to check what will be deleted Ø No way to inhibit delete workflow

Running Sth. Mdel www. softwaretoolhouse. com • • • • • • • Sth. Running Sth. Mdel www. softwaretoolhouse. com • • • • • • • Sth. Mdel Version 1. 2 (c) Copyright 2002 -2006 by Software Tool House Inc. www. softwaretoolhouse. com Sth. Mdel will delete a single record from the specified schema with the specified Id. Sth. Mdel [ -i ] Sth. Mdel -q[x] Sth. Mdel -p Svr Svr Usr Port Pwd Usr Sch Pwd Id query. . Sch Id. . where: -d -n -i -q -x -p Svr Port Usr Pwd Sch Id Qry note: switches must be combined is full tracing (very large, appended) indicates null operation do not normalise the specified ID a query is specified and all records returned are deleted if not specified, a single record with the passed ID is deleted a confirmation is not required when deleting more than one record the Port parameter is supplied may be used with -i, -q, -n Remedy ARS server name or ip the Remedy server port to connect on ARS User name Password for User; use "-" for no password The schema (form) to delete; may be quoted The Id to delete; does not need to be fully formatted. unless -i specified. The query to execute; all returned records are deleted.

Running www. softwaretoolhouse. com Sth. Msch Ø Used to print field information on ARS Running www. softwaretoolhouse. com Sth. Msch Ø Used to print field information on ARS Schemas Ø Will output query results to stdout as text or as CSV

Running www. softwaretoolhouse. com Sth. Msch • • • Meta-Schema Version 2. 40 for Running www. softwaretoolhouse. com Sth. Msch • • • Meta-Schema Version 2. 40 for ARS lib 6. 01 (c) copyright 1996 -2008 by Software Tool House Inc. www. softwaretoolhouse. com • Usage: • • • Sth. Msch [-flm{dj}o. Os. J] [yyyy. mm. dd] svr Sth. Msch -x[{dj}o. Os. J] [yyyy. mm. dd] svr Sth. Msch -p svr port usr usr pwd pwd [+-][Sch]. . • • • • • • where -p -P -x • • Sch if coded, dumps only the schema(s) specified wildcards: * (0. . n. C) or (C) where C is a case sensitive character says the port parameter is included and follows the server says dump an extra permissions report at the end says to dump CSV (Excel) format in place of text in stdout mutually exclusive with -flm; implies -h -f says to dump filters in alpha seq -l says to dump active links -m says to dump menus -o says to NOT dump schemas / fields that are Display. Only or trim -O says to dump all schemas but only standrad fields no trim, tables etc) -h says to dump field help as well -s says to list schemas only -J says to dump join map if -s coded; else assumed -d says to dump change dates from this date -j says to dump only changes from this date yyyy. mm. dd date must be specified as first parm if -d coded and cannot be specified if not coded svr is the unix server name port is the server's listening port (-p coded) usr is the Remedy user id to login with pwd is the password fo the supplied user id use a - as the password to indicate no password

Running www. softwaretoolhouse. com Sth. Msch • Sth. Msch –p %Ars. Svr% %Ars. Port% Running www. softwaretoolhouse. com Sth. Msch • Sth. Msch –p %Ars. Svr% %Ars. Port% %Ars. Usr% %Ars. Pwd% “HPD: Help Desk” • Sth. Msch –px %Ars. Svr% %Ars. Port% %Ars. Usr% %Ars. Pwd% “HPD: Help Desk” > hpd_hd. sch. csv • Sth. Msch –px %Ars. Svr% %Ars. Port% %Ars. Usr% %Ars. Pwd% * > server. sch. csv

Agenda Objectives www. softwaretoolhouse. com A First View of Meta-Update Scripting Running Meta-Update Main Agenda Objectives www. softwaretoolhouse. com A First View of Meta-Update Scripting Running Meta-Update Main and Read Server Sections Control Sections File and Field Sections Assignment Sections Lookup Sections Samples

Scripting: Main www. softwaretoolhouse. com Main Section Ø Required in every script Ø ARS Scripting: Main www. softwaretoolhouse. com Main Section Ø Required in every script Ø ARS Server session establishment and authentication including and timeouts and client types Ø Names script arguments Ø Specifies number of required arguments and the usage information Ø Specifies an “Id Log” file name Ø Specifies additional “Read Server” sections

Scripting: Main www. softwaretoolhouse. com Main Section Server • $ENV, Ars. Svr$ • dev. Scripting: Main www. softwaretoolhouse. com Main Section Server • $ENV, Ars. Svr$ • dev. sth. com Port • $ENV, Ars. Port$ • 2508 User • $ENV, Ars. Usr$ • Demo Password • $ENV, Ars. Pwd$ • — Arg. Nm Prm. Req Read. Servers License • As many as the scripts defines • n, usage information • n is the number of required arguments • Sec, sec, … • Lists Read. Server sections to be used • GW 5 T-HQJ 8 FG

www. softwaretoolhouse. com Read. Server Sections Scripting: Read. Server Ø Allows queries on other www. softwaretoolhouse. com Read. Server Sections Scripting: Read. Server Ø Allows queries on other servers Ø Required if specified in Main Ø ARS Session authentication and establishment Ø Set timeouts, client types Ø Specifies a Tag for this session / server

Scripting: Read. Server www. softwaretoolhouse. com Read Server Sections Tag Server • Src. Svr Scripting: Read. Server www. softwaretoolhouse. com Read Server Sections Tag Server • Src. Svr • The name that will be referenced within the script in Load. Q=, Query. Sql= • 192. 168. 0. 1 • dev. sth. com Port • 0 • 2508 User • test 1 • Demo Password • test 1 • —

Agenda Objectives www. softwaretoolhouse. com A First View of Meta-Update Scripting Running Meta-Update Main Agenda Objectives www. softwaretoolhouse. com A First View of Meta-Update Scripting Running Meta-Update Main and Read Server Sections Control Sections File and Field Sections Assignment Sections Lookup Sections Samples

Agenda Objectives www. softwaretoolhouse. com A First View of Meta-Update Scripting Running Meta-Update Main Agenda Objectives www. softwaretoolhouse. com A First View of Meta-Update Scripting Running Meta-Update Main and Read Server Sections Control Sections File and Field Sections Control Sections — saying what to do in a script Assignment Sections Control Section flowchart — with Lookup Sections statements Samples

Control Sections www. softwaretoolhouse. com Control Sections Ø Main work engine of Meta-Update Ø Control Sections www. softwaretoolhouse. com Control Sections Ø Main work engine of Meta-Update Ø Can iterate through an ARS, SQL query, file, string, diary field Ø Specifies output: ARS, File, Merge, etc and assignment sections Ø Can conditionally launch other control sections Ø Specifies assignment sections

Control Sections www. softwaretoolhouse. com Control Sections Control Sections www. softwaretoolhouse. com Control Sections

Control Sections www. softwaretoolhouse. com Control Sections www. softwaretoolhouse. com

Control Sections www. softwaretoolhouse. com Assignments [Do] Assign. Init Assign. Pre Assign. Post Assign. Control Sections www. softwaretoolhouse. com Assignments [Do] Assign. Init Assign. Pre Assign. Post Assign. Term = = Do-asg. Init Do-asg. Pre Do-asg. Post Do-asg. Term [Do-asg. Init] @Cmd = Ref, V, Guid, @exec, Application-Generate-Guid & AB [Do-asg. Pre] @Cmd = Ref, V, F-R, @regex, & #(. *)/(. *)#, $Ci. Src, Model$ @Cmd = Ref, V, Ctr, @eval, $V, Ctr$+1 [Do-asg. Post] @Cmd = Ref, V, dmy, @exec, Application-Delete-Entry “$V, tmp. Sch$” $V, tmp. Req. Id$ & &

Control Sections www. softwaretoolhouse. com Assignments [Do] Update Assign. New = Upd, & $V, Control Sections www. softwaretoolhouse. com Assignments [Do] Update Assign. New = Upd, & $V, Schema$, & ‘ 179’ = “$V, iid$” = Do-asg. Upd = Do-asg. Cre, Do-asg. Upd [Do-asg. Cre] 179 = V, iid [Do-asg. Upd] Status = Assigned Notes = Src, Notes

Control Sections www. softwaretoolhouse. com Iteration @Src. Svr, Query = Src, HPD: Help Desk, Control Sections www. softwaretoolhouse. com Iteration @Src. Svr, Query = Src, HPD: Help Desk, @sort(Category, Type, ‘Priority’ = “High” Item), HPD: Help Desk, ‘Priority’ = “High” & & &

Control Sections www. softwaretoolhouse. com Iteration Query. Sql = Src. Q, @Src. Svr, @na, Control Sections www. softwaretoolhouse. com Iteration Query. Sql = Src. Q, @Src. Svr, @na, Src. Q, select Request_Id @na, from select HPD_Help_Desk, Request_Id where Priority = 4 from HPD_Help_Desk, where Priority = 4 & & &

Control Sections www. softwaretoolhouse. com Iteration File = Fle, File-Decl, $Arg, Fle$-ppl. csv & Control Sections www. softwaretoolhouse. com Iteration File = Fle, File-Decl, $Arg, Fle$-ppl. csv & & [File-Decl] Type = Delimited, “; ”, Fld. Hdr Fields = File-Decl-Fields [File-Decl-Fields] Date = $ Date: “yyyy-mm-dd”

Control Sections www. softwaretoolhouse. com Iteration Loop & = String, (“$V, Do$”) Diary, While, Control Sections www. softwaretoolhouse. com Iteration Loop & = String, (“$V, Do$”) Diary, While, V, & “3”, & “; ”, $Hpd. Src, Notes$ $Hpd. Src, Status-History$ 112$

Control Sections www. softwaretoolhouse. com Output Update Create = Hpd. Tgt, Fle, & = Control Sections www. softwaretoolhouse. com Output Update Create = Hpd. Tgt, Fle, & = Hpd. Tgt, & File-Decl, HPD: Help Desk, & HPD: Help Desk $Arg, Fle. Out$. csv ‘ 179’ = “$Hpd. Src, 179$” Assign = Hpd. Asg Assign. Open Assign. New = Hpd. Asg Merge = Yes, No. Workflow

Control Sections www. softwaretoolhouse. com Launch = Do. Relations = @if(“$V, Do$” == 1) Control Sections www. softwaretoolhouse. com Launch = Do. Relations = @if(“$V, Do$” == 1) Do. Next &

Agenda Objectives www. softwaretoolhouse. com A First View of Meta-Update Scripting Running Meta-Update Main Agenda Objectives www. softwaretoolhouse. com A First View of Meta-Update Scripting Running Meta-Update Main and Read Server Sections Control Sections File and Field Sections Assignment Sections Lookup Sections Samples

Scripting: File www. softwaretoolhouse. com File & Field Sections Ø Specifies input and output Scripting: File www. softwaretoolhouse. com File & Field Sections Ø Specifies input and output files Ø Section name in File= and Output= Fixed Format Columns may overlap Fields Required Delimited Pattern Columns can be in any order Output only First Line can have column name and/or fields can be specified Delimiter, quote can be specified; values can have embedded new lines Contains no fields Assignments are textual Multifile option creates a new file with each output

Scripting: File www. softwaretoolhouse. com File Sections Type Fields Format Error. File • Delimited, Scripting: File www. softwaretoolhouse. com File Sections Type Fields Format Error. File • Delimited, “, ” [ , Fld. Hdr ] • Fixed • Pattern [ , Multi ] • Field Section Name • Required for output, fixed, optional for delimited with Fld. Hdr, n/a for pattern • Csv • Excel • Only for Delimited files • Name • Only on delimited; output is a CSV of input records that caused errors.

Scripting: Field www. softwaretoolhouse. com Field Sections Ø Used in output files, input delimited Scripting: Field www. softwaretoolhouse. com Field Sections Ø Used in output files, input delimited and fixed files, SQL Queries, regular expression extracts Ø Specifies field names and interpretation rules SQL Fixed Delimited Format regex Start and ending column specified Fields Required Columns are ‘$’ When field headers on input or for output files, all columns need to be specified With field headers on input, columns can be in any order All fields must be specified

Scripting: Field www. softwaretoolhouse. com Field Sections Field-Name • N, M [ format ] Scripting: Field www. softwaretoolhouse. com Field Sections Field-Name • N, M [ format ] • $ [ format ] field 1 = $ Date epoch field 2 = $ Trim quoted both format field 3 = $ Date “yyyy-Mm-dd hh: mm: ss” • Trim[ quoted ] { leading | trailing | both } field 4 | $ Subst /^+// Subst /^$// • Date { epoch =julian | “date-spec” } • Subst [^] string [$] / string / field 5 / = $ • Nulls { $NULL$ | “” | “xxx” } date-spec • • • yyyy | yy Year M | Mmmm Month d | dd Day h | hh Hour m | mm Minute s | ss Second

www. softwaretoolhouse. com File and Field Sections www. softwaretoolhouse. com File and Field Sections

Agenda Objectives www. softwaretoolhouse. com A First View of Meta-Update Scripting Running Meta-Update Main Agenda Objectives www. softwaretoolhouse. com A First View of Meta-Update Scripting Running Meta-Update Main and Read Server Sections Control Sections File and Field Sections Assignment Sections Lookup Sections Samples

Agenda Objectives www. softwaretoolhouse. com Assignment Sections — assigning values to update fields What Agenda Objectives www. softwaretoolhouse. com Assignment Sections — assigning values to update fields What you can do in Assignment A First View of Meta-Update Scripting Sections Types of Assignments: Targeted, Running Meta-Update Untargeted, String Loading Server Sections Main and Read Records Conditional Control Sections Assignment Commands File and Field Sections Assignment Sections Lookup Sections Samples

www. softwaretoolhouse. com Assignment Sections Ø Assignment sections are used to assign values to www. softwaretoolhouse. com Assignment Sections Ø Assignment sections are used to assign values to ARS or CSV fields when updating or creating records. Ø Assignment sections are also used to assign scripts variables, control script flow, launch client and server processes, and load records. Ø Assignment sections are specified by the Assign. Xxx keywords in Control Sections

www. softwaretoolhouse. com Assignments Assignment Sections Ø Full nested ifs Ø Conditional Includes Ø www. softwaretoolhouse. com Assignments Assignment Sections Ø Full nested ifs Ø Conditional Includes Ø Matching field copy commands Ø Arithmetic expressions Ø Look-Ups using external files, internal lists, ARS or SQL queries or functions Ø Script variables including ARS records Ø Automatic type conversions Ø Regular expression string extraction Ø Server and client processes including the standard filter processes

www. softwaretoolhouse. com Assignment Sections Ø There are three types of Assignment Sections: Targeted www. softwaretoolhouse. com Assignment Sections Ø There are three types of Assignment Sections: Targeted Pattern Untarget ed • Used with ARS and CSV updates and output Field = Value • Used with pattern files and reference assignments String = “Value” • Used when no output is done to assign script variables and spawn processes @Cmd = Command Assignment Sections Targeted and Pattern sections may also assign script variables and spawn processes.

www. softwaretoolhouse. com Targeted Sections Targeted Assignment Sections • Used with ARS and CSV www. softwaretoolhouse. com Targeted Sections Targeted Assignment Sections • Used with ARS and CSV updates and output Field = Value Ø Control Section keywords specifying sections: ARS Update= Create= CSV Output= Ø Fields are assigned simple references or constants. Type conversion is automatic: Assign= Assign. Open= Date. Field = Csv. File, input-date Assign. New= Assign. Close Status = ”Assigned”

www. softwaretoolhouse. com Pattern Sections Assignment Sections • Used with pattern files and reference www. softwaretoolhouse. com Pattern Sections Assignment Sections • Used with pattern files and reference assignments String = “Value” Ø Control Section keywords specifying sections: Ø Only two “pseudo-fields” String = “Value” File = file-name • • • Output= Ø Value name must be an accessible as File’s is a “String Reference” such ASCII file. Stringfile contains open var$ including string The = ”text $ENV, textn” Assign= String = ”text $other-Rec, field$ text” Assign. Open= references: Assign. Close File = ”$CFG, PTN-DIR$\index. ptn”

www. softwaretoolhouse. com Untargeted Sections Untarget ed Assignment Sections • Used when no output www. softwaretoolhouse. com Untargeted Sections Untarget ed Assignment Sections • Used when no output is done to assign script variables and spawn processes @Cmd = Command Ø Control Section keywords specifying sections: Ø Only two “pseudo-fields” @Cmd = command Load. Q = load query • • • All assignment section Assign. Init= include types can Assign. Pre= these types of assignments. Untargeted Assign. Post= Assign. Post. Launch= sections can only include these Assign. Term= statements.

www. softwaretoolhouse. com Untargeted Sections Assignment Sections Ø Use @Cmd for special assignment command www. softwaretoolhouse. com Untargeted Sections Assignment Sections Ø Use @Cmd for special assignment command such as assignments to script variables, spawning processes controlling script flow, extracting attachments. @Cmd = command Ø Use Load. Q to load additional ARS records. Note that Look. Ups can also load records. Load. Q = Tag, Schema, Query

Assignment Sections Conditional Assignments www. softwaretoolhouse. com Ø All assignments — including commands — Assignment Sections Conditional Assignments www. softwaretoolhouse. com Ø All assignments — including commands — can be made conditional by prefixing the assignment value with an @if condition. Ø There are two “immediate if” constructs: No assignment if field the expression is = @if(exp) value false. = @if(exp, true_val, false_val) Ø There is also a fully structured if @Cmd = @if(exp) field 1 = true_value @Cmd = else field 2 = false_value @Cmd = endif Assignment is facility: made. always Assignments can be made to different fields. Ifs can be nested.

Expressions www. softwaretoolhouse. com Assignment Sections Ø Logical operators: ! && || Not And Expressions www. softwaretoolhouse. com Assignment Sections Ø Logical operators: ! && || Not And Or !(“$V, Ctr$” > 3) && (“$V, Ctr$” < 7) (“$V, Ctr$” <= 3) || (“$V, Ctr$” >= 7) Ø Relational operators != == ~= > < >= <= Not equal Equal Prefix match — “starts with” Greater than Less than Greater than or equal Less than or equal Ø Numerical operators not handled; make special numerical assignments to variables. Case insensitive !=~ operators. ==~ ~=~ Numerical >~ compare only if <~ both terms are >=~ numbers else <=~ character compare. $NULL$ and ”” are equivalent.

www. softwaretoolhouse. com @Cmd Statements Assignment Sections Ø @Cmd is a pseudo-field and executes www. softwaretoolhouse. com @Cmd Statements Assignment Sections Ø @Cmd is a pseudo-field and executes special assignment commands to: Please see ü ü ü ü the Metaassign script variables spawn client and server processes Update User’s Guide do lookups which can result in loaded records and SQL rows Perform regular expression substring extracts abort a script section and issue log and console messages more control assignments with a structured if facility copy fields from a loaded sections in targeted Only include other assignment Tag assignments.

www. softwaretoolhouse. com Load. Q Statements Assignment Sections Ø Load. Q is a pseudo-field www. softwaretoolhouse. com Load. Q Statements Assignment Sections Ø Load. Q is a pseudo-field that load additional ARS records into the specified Tag. Load. Q = [ @Read-Server-Tag, ] & Tag, & Schema, & Query The load query must yield exactly one record else an error is thrown. Note that Look. Ups can also be used to load records and allow failure.

www. softwaretoolhouse. com Assignment Sections www. softwaretoolhouse. com Assignment Sections

Agenda Objectives www. softwaretoolhouse. com A First View of Meta-Update Scripting Running Meta-Update Main Agenda Objectives www. softwaretoolhouse. com A First View of Meta-Update Scripting Running Meta-Update Main and Read Server Sections Control Sections File and Field Sections Assignment Sections Lookup Sections Samples

Look. Up Sections www. softwaretoolhouse. com Look. Up Sections Ø Provides a mechanism for Look. Up Sections www. softwaretoolhouse. com Look. Up Sections Ø Provides a mechanism for value lookups and translations Ø Can use any combination of ü internal script lists ü CSVs ü ARS Queries ü SQL Queries and functions

Look. Up Sections www. softwaretoolhouse. com Look. Up Sections Ø Use in assignments and Look. Up Sections www. softwaretoolhouse. com Look. Up Sections Ø Use in assignments and reference commands Field = @Look. Up, Lk. Up-section, lookup_$Tag, field$_term & & @Cmd & & & = Ref, My. Vars, new_val, @Look. Up, Lk. Up-section, lookup_$Tag, field$_term [Lk. Up-setion] Val_1 = lookup_xxx_term

Look. Up Sections www. softwaretoolhouse. com Look. Up Sections No. Match Default • [ Look. Up Sections www. softwaretoolhouse. com Look. Up Sections No. Match Default • [ D I W E ], [ Default | Skip | Error ] • First parameter is the message level • Second indicates action if no • “string reference” match • List, File, Query. Sql Order CTL, Look. Up_Src CTL, Look. Up • Specifies order of search when multiple lists are defined. On entry, set to the string being Looked Up. On exit, contains how the match occurred, one of: Default, List, File, Query. Sql

Look. Up Sections www. softwaretoolhouse. com Loade d on first use. List File Query Look. Up Sections www. softwaretoolhouse. com Loade d on first use. List File Query Dynami c Query. Sql • Value_1 • Value_2 = = • File and name • File. Source • File. Target • File. If to be • Query. Source • Query. Target • Query. Multi = same as a File= with a Tag, file definition one record • Query. Sql. Source • Query. Sql. Target • Query. Multi one record Look. Up_Src_1 Look. Up_Src_2 = string expression for the look up term = string expression for the look up result = expression that returns True for the record included in the Look. Up = same as Query=with a Tag, Schema, Query = string expression for the look up term = string expression for the look up result = [ Error | First ] Option when the Query returns more than = gives the Query. Sql=Tag, field-section, = string expression for the look up term = string expression for the look up result = [ Error | First ] What to do if the Query returns more than A single Look. Up section can use any combination of the above. Use Order= to control matching order as per the=default: File, Query. Sql Order List, @Cmd = Use $CTL, Look. Up$ to distinguish multiple returns @if (”$CTL, Look. Up$” == ”Default”) asg_field = Lk. Up_Sql, field @Cmd = endif &

Look. Up Sections www. softwaretoolhouse. com Look. Up Sections Look. Up using a file Look. Up Sections www. softwaretoolhouse. com Look. Up Sections Look. Up using a file — Show on next click Look. Up using a simple list within the script

Agenda Objectives www. softwaretoolhouse. com A First View of Meta-Update Scripting Running Meta-Update Main Agenda Objectives www. softwaretoolhouse. com A First View of Meta-Update Scripting Running Meta-Update Main and Read Server Sections Control Sections File and Field Sections Assignment Sections Lookup Sections Samples

Sample Scripts www. softwaretoolhouse. com Sample Scripts Ø Sample scripts are included in the Sample Scripts www. softwaretoolhouse. com Sample Scripts Ø Sample scripts are included in the distribution. Ø The Script Library section of the web has additional scripts for download. Ø Samples use the Sth. Lic environment variables for ARS server addressing and authentication.

Sample Scripts www. softwaretoolhouse. com ARS Server Info Report Ø ARS Server Info report Sample Scripts www. softwaretoolhouse. com ARS Server Info Report Ø ARS Server Info report Two scripts generate an ASCII and CSV file of the predefined tag: AR_INFO which contains all available ARS Server information. Ø Demonstrates These simple scripts demonstrate an Output= of a “single” record to a pattern file. They do no Query or other iteration. They use assignments based on your server version.

Sample Scripts ITSM Associations Report www. softwaretoolhouse. com Ø ITSM HPD, CHG, PBM CI Sample Scripts ITSM Associations Report www. softwaretoolhouse. com Ø ITSM HPD, CHG, PBM CI Associations Report This script generates a CSV listing all HPD, CHG, PBM Ø associations to CIs and lists some identifying info from the CI. Demonstrates This simple script demonstrates how to process a Query= statement on three independent tables, load related records for each, and create a single CSV file containing data from both the three independent tables and the loaded records.

Sample Scripts www. softwaretoolhouse. com ITSM Relations Report Ø ITSM CI to CI Relationships Sample Scripts www. softwaretoolhouse. com ITSM Relations Report Ø ITSM CI to CI Relationships Report This script generates a CSV listing all CI relationships with identifying info from the relationship and both related CIs. Ø Demonstrates This simple script demonstrates how to process a Query= statement fired on a single table, load related records for each relationship record, and create a single CSV file containing data from all three records.

More Information www. softwaretoolhouse. com Contact Us www. Software Tool House. com Ø Binaries, More Information www. softwaretoolhouse. com Contact Us www. Software Tool House. com Ø Binaries, trial licenses, User’s Guide available on the web. http: //www. softwaretoolhouse. com Ø Download the Manual. Ø Look at the sample scripts. Ø Pick up a trial license. Ø See Contact Us at www. softwaretoolhouse. com

www. softwaretoolhouse. com Assignment Sections @Cmd Statements Ø Assigning script variables @Cmd = Ref, www. softwaretoolhouse. com Assignment Sections @Cmd Statements Ø Assigning script variables @Cmd = Ref, Tag, Var, assign “Value” to $Tag, Value Var$ Process the string assignments in @sec and @secassign resulting buffer Evaluate exp as an integer expression and assign the @eval, exp result Use a special server filter process and assign the result @Cmd = Ref, Tag, Var, @exec, Application-Generate-GUID @Cmd = Ref, Tag, Var, @guid, & OI OI

www. softwaretoolhouse. com Assignment Sections @Cmd Statements Ø Assigning script variables @Cmd = Ref, www. softwaretoolhouse. com Assignment Sections @Cmd Statements Ø Assigning script variables @Cmd = Ref, Tag, Name, assign “Name” as an equivalent of Tag @equ Create a variable based on an ARS record. @Cmd = Ref, Tag, Sec, @ars, [@Svr. Tag, ] Schema [, @init] & The section is processed as a targeted ARS assignments. If the Tag is new or @init is coded, the in-memory record’s fields are all NULL. Otherwise, additional assignments are made to the in-memory record.

www. softwaretoolhouse. com @Cmd Statements Assignment Sections Ø Assigning script variables Assign the different www. softwaretoolhouse. com @Cmd Statements Assignment Sections Ø Assigning script variables Assign the different fields declared in [Field-sec] from the regular expression extracts if a Field-sec, match occurred. @regex, & @Cmd = Ref, Tag, /regex/, Value PCRE — Perl Compatible Regular Expressions are used. $Tag, @rc$ contains 1 if the expression was matched or 0 if not matched. The regular expression must be delimited by any character not in the expression and can contain variables and substitutions. The Value is a string expression.

www. softwaretoolhouse. com @Cmd Statements Assignment Sections Ø Assigning script variables @Cmd = Ref, www. softwaretoolhouse. com @Cmd Statements Assignment Sections Ø Assigning script variables @Cmd = Ref, Tag, /delete Delete a Tag and all its fields. Delete a single field. @Cmd = Ref, Tag, field, These are generally not needed. /delete

www. softwaretoolhouse. com @Cmd Statements Assignment Sections Ø Including other sections @Cmd = Include, www. softwaretoolhouse. com @Cmd Statements Assignment Sections Ø Including other sections @Cmd = Include, Include another assignment section. Section must exist. Include another assignment section if it exists. Sec-$Tag, My. Sec$

www. softwaretoolhouse. com @Cmd Statements Assignment Sections Ø Spawning client processes @Cmd = Spawn, www. softwaretoolhouse. com @Cmd Statements Assignment Sections Ø Spawning client processes @Cmd = Spawn, Command Run a process on the same machine as Meta. Update. Script will wait until process completion.

www. softwaretoolhouse. com @Cmd Statements Assignment Sections Ø Issue messages or abort an iteration www. softwaretoolhouse. com @Cmd Statements Assignment Sections Ø Issue messages or abort an iteration @Cmd = Msg, Lvl, @Cmd = Abort, D I W E Lvl, Text Issue a message to the console and log depending on the Lvl being logged. Abort this iteration of this command section and issue the message to the console and log file. Debug level — normally inhibited Information Warning Error

www. softwaretoolhouse. com @Cmd Statements Assignment Sections Ø Copy like fields from one tag www. softwaretoolhouse. com @Cmd Statements Assignment Sections Ø Copy like fields from one tag to the target The assignment section is targeted to an ARS or CSV record. @Cmd = Copy, Tag [, ( Dup. Append | Dup. Overwrite | Dup. Ignore )] [, ( Mismatch. Ignore | Mismatch. Warn | Mismatch. Error )] [, ( Core. Assign | No. Core. Assign )] [, @if(exp) ] The Tag refers to a loaded [, Skip: fld [ , . . ] ] ARS or CSV record. Fields are matched based on name or field-id as appropriate by the types participating. A shortcut for assignment sections and used if you don’t know the schema structures of the assignment target or the loaded Tag reference. Only in targeted assignments.




  • Мы удаляем страницу по первому запросу с достаточным набором данных, указывающих на ваше авторство. Мы также можем оставить страницу, явно указав ваше авторство (страницы полезны всем пользователям рунета и не несут цели нарушения авторских прав). Если такой вариант возможен, пожалуйста, укажите об этом.