Tib Cim Rulebaseguide

of 192 /192
TIBCO Collaborative Information Manager™ Rulebase Guide Software Release 8.1.0 January 2011

Embed Size (px)

Transcript of Tib Cim Rulebaseguide

TIBCO Collaborative Information Manager Rulebase GuideSoftware Release 8.1.0 January 2011

Important InformationSOME TIBCO SOFTWARE EMBEDS OR BUNDLES OTHER TIBCO SOFTWARE. USE OF SUCH EMBEDDED OR BUNDLED TIBCO SOFTWARE IS SOLELY TO ENABLE THE FUNCTIONALITY (OR PROVIDE LIMITED ADD-ON FUNCTIONALITY) OF THE LICENSED TIBCO SOFTWARE. THE EMBEDDED OR BUNDLED SOFTWARE IS NOT LICENSED TO BE USED OR ACCESSED BY ANY OTHER TIBCO SOFTWARE OR FOR ANY OTHER PURPOSE. USE OF TIBCO SOFTWARE AND THIS DOCUMENT IS SUBJECT TO THE TERMS AND CONDITIONS OF A LICENSE AGREEMENT FOUND IN EITHER A SEPARATELY EXECUTED SOFTWARE LICENSE AGREEMENT, OR, IF THERE IS NO SUCH SEPARATE AGREEMENT, THE CLICKWRAP END USER LICENSE AGREEMENT WHICH IS DISPLAYED DURING DOWNLOAD OR INSTALLATION OF THE SOFTWARE (AND WHICH IS DUPLICATED IN THE LICENSE FILE) OR IF THERE IS NO SUCH SOFTWARE LICENSE AGREEMENT OR CLICKWRAP END USER LICENSE AGREEMENT, THE LICENSE(S) LOCATED IN THE LICENSE FILE(S) OF THE SOFTWARE. USE OF THIS DOCUMENT IS SUBJECT TO THOSE TERMS AND CONDITIONS, AND YOUR USE HEREOF SHALL CONSTITUTE ACCEPTANCE OF AND AN AGREEMENT TO BE BOUND BY THE SAME. This document contains confidential information that is subject to U.S. and international copyright laws and treaties. No part of this document may be reproduced in any form without the written authorization of TIBCO Software Inc. TIBCO, The Power of Now, TIBCO BusinessConnect, TIBCO ActiveMatrix BusinessWorks, TIBCO Enterprise Message Service are either registered trademarks or trademarks of TIBCO Software Inc. in the United States and/or other countries. EJB, Java EE, J2EE, and all Java-based trademarks and logos are trademarks or registered trademarks of Sun Microsystems, Inc. in the U.S. and other countries. All other product and company names and marks mentioned in this document are the property of their respective owners and are mentioned for identification purposes only. THIS SOFTWARE MAY BE AVAILABLE ON MULTIPLE OPERATING SYSTEMS. HOWEVER, NOT ALL OPERATING SYSTEM PLATFORMS FOR A SPECIFIC SOFTWARE VERSION ARE RELEASED AT THE SAME TIME. SEE THE README FILE FOR THE AVAILABILITY OF THIS SOFTWARE VERSION ON A SPECIFIC OPERATING SYSTEM PLATFORM. THIS DOCUMENT IS PROVIDED AS IS WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT. THIS DOCUMENT COULD INCLUDE TECHNICAL INACCURACIES OR TYPOGRAPHICAL ERRORS. CHANGES ARE PERIODICALLY ADDED TO THE INFORMATION HEREIN; THESE CHANGES WILL BE INCORPORATED IN NEW EDITIONS OF THIS DOCUMENT. TIBCO SOFTWARE INC. MAY MAKE IMPROVEMENTS AND/OR CHANGES IN THE PRODUCT(S) AND/OR THE PROGRAM(S) DESCRIBED IN THIS DOCUMENT AT ANY TIME. THE CONTENTS OF THIS DOCUMENT MAY BE MODIFIED AND/OR QUALIFIED, DIRECTLY OR INDIRECTLY, BY OTHER DOCUMENTATION WHICH ACCOMPANIES THIS SOFTWARE, INCLUDING BUT NOT LIMITED TO ANY RELEASE NOTES AND "READ ME" FILES. This Product is covered by U.S. Patent No. 7,472,101. Copyright 1999-2011 TIBCO Software Inc. ALL RIGHTS RESERVED. TIBCO Software Inc. Confidential Information

| iii

Contents

Preface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ixChanges from the Previous Release of this Guide . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . x Related Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xi TIBCO Collaborative Information Manager Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xi Other TIBCO Product Documentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xi Typographical Conventions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xiii How to Contact TIBCO Support. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .xiv

Chapter 1 Getting Started with Rules . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .1Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2 Establishing an XML Rules File . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 New Record File . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4 Validation File . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4 Search Control Rules File. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4 Structure of a Rulebase File . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5 Header . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 Variable Declarations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 declare . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 var. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10 datatype . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10 link . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11 Actions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18 assign . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19 check . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24 clear . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25 condition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25 connect . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28 disconnect . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30 duplicate . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31 enum. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32 propagate . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34 refresh . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35 select . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38 slice . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41 softlink . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42 table . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44TIBCO Collaborative Information Manager Rulebase Guide

iv

| Contentsusefor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45 Access Modes. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47 Global Property Settings for Rules . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56 LogFlag . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56 Checking Attribute Names . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56

Chapter 2 Expressions. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59SQL Expressions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Restrictions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Locations of datasource and classifications. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . table . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Selecting Columns . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . where . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Placeholders . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . sql Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Debugging Statements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Context Variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . SESSION . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . WORKITEM . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . PREVIOUS_VERSION, PREVIOUS_CONFIRMED_VERSION . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . CONTEXT_RELATIONSHIP/NAME . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . RECORD_ACTION . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . RECORD_SUB_ACTION . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . RECORD_IS_TOPMOST . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . RECORD_IS_BOTTOMMOST . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . PARENT. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . CHILD . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60 60 60 60 64 64 65 66 68 69 69 70 71 72 73 75 76 76 77 78

Chapter 3 Operator and Character Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79Overview of Operators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Logical . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Comparison . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . String . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Math . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Other . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Logical Operators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . and compute logical and . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . not compute logical not . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . or compute logical or . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 80 80 80 81 81 81 83 83 85 85

Comparison Operators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 87 changed test an attribute to see if it has changed. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 87 defined determine if value is defined. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 88

TIBCO Collaborative Information Manager Rulebase Guide

Contents v

|

eq equals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 88 geq greater than or equal. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 90 gt greater than . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 90 in check if argument contained in a list . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 90 leq less than or equal . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 91 lt less than . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 91 match regular expression match . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 91 neq not equal . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 92 undefined determine if value is undefined . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 93 String Operators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 94 concat concatenate string values. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 94 length compute length of string . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 94 pad pads a string on left or right . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 95 substring . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 96 trim trims leading and trailing spaces. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 97 uppercase returns uppercase of input . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 97 Math Operators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 98 div divides values . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 98 minus calculates subtraction of values. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 99 mult multiplies values . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 100 percent computes percentage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 101 plus calculates addition of values. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 102 round rounds to a defined set of decimal places . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 103 Other Operators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 106 checkdigit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 106 count count number of (non-null, non-false) entries in array . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 107 distinct returns distinct values . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 107 filter filter a list of records . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 108 lookup lookup value in database . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 109 max maximum value . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 110 min minimum value . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 110 nvl substitute non-NULL value . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 111 sequence returns a database sequence . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 112 strip removes all null values from an array . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 113 synchstatus. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 113 SyncOperationAttribute used to find the operation date (GDSN Only) . . . . . . . . . . . . . . . . . . . . . . . . . . 114 validate_checkdigit - validates checkdigit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 114 Syntax for Expressions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 116 Special Characters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 116 const . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 116 var. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 117 Undefined (Null) Values . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 117 Regular Expressions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 118 Literal Characters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 118TIBCO Collaborative Information Manager Rulebase Guide

vi

| ContentsCharacter Classes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Position Characters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Repetition Characters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Alternation, Grouping, Reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 119 119 120 121

Built-in Functions. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 122 Custom Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 123 Creating a Custom Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 123

Chapter 4 Rulebase Patterns. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 127Non-Negative Numbers. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 128 Dependent Variables. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 129 Dependent Drop-Down Values . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 130 Specify Data Sources . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 133 Checking Child Records for Value. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 134

Chapter 5 Rulebase Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 137Rulebase Header . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 139 Specify Mandatory Attributes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 140 Access Modes. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 141 Check for a Value (GTIN) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 142 CATALOG_NAME Variable . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 143 Specify Valid Numbers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 144 Assign TRUE or FALSE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 145 Check Values of Related Attributes. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 146 Check Values of Attributes Related to MINIMUM_SHIP . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 147 Check Code Length . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 148 Validate Code . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 149 Validate Temperature Values . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 150 Skip First Pass . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 152 Specify Valid Values . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 154 Check for DIMENSIONUOM . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 155 Specify Types For a Drop-Down Menu . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 156 Check Length of UPC Code . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 157 Validate Against First Order Date . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 159 Validate Against First Ship Date . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 160 Validate Net Weight. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 161 Calculate Volume . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 162

TIBCO Collaborative Information Manager Rulebase Guide

Contents vii

|

Specify New Size . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 163 Propagate Attribute Value to Children . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 164

Chapter 6 Embedding Rulebases . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .165Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 166 Procedure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 167 Error Handling and Debugging . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 168

Appendix A Synch_History . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .169SYNCH_HISTORY. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 170

Appendix B System Variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .175System Implicit Variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 176

Index . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .177

TIBCO Collaborative Information Manager Rulebase Guide

viii

| Contents

TIBCO Collaborative Information Manager Rulebase Guide

| ix

Preface

The TIBCO Collaborative Information Manager delivers functionality to administer processes for management and governance of master data. This ensures accuracy and efficiency both inside the enterprise as well as throughout the value chain so that multiple processes are optimally coordinated. TIBCO Collaborative Information Manager delivers a horizontal platform to manage all types of information including products, customers, vendors, reference data, trading partners, and so on.

Topics Changes from the Previous Release of this Guide, page x Related Documentation, page xi Typographical Conventions, page xiii How to Contact TIBCO Support, page xiv

TIBCO Collaborative Information Manager Rulebase Guide

x

| Changes from the Previous Release of this GuideChanges from the Previous Release of this GuideThis release does not include any changes to this Guide.

TIBCO Collaborative Information Manager Rulebase Guide

Preface xi

|

Related DocumentationThis section lists documentation resources you may find useful.

TIBCO Collaborative Information Manager DocumentationThe following documents form the TIBCO Collaborative Information Manager documentation set: TIBCO Collaborative Information Manager Installation and Configuration Guide: Read this manual for instructions on site preparation, installation, and configuration. TIBCO Collaborative Information Manager Users Guide: This manual explains features and benefits of TIBCO Collaborative Information Manager from the business users viewpoint. It describes the features and functionality as well as all the screens. TIBCO Collaborative Information Manager System Administrators Guide: This manual explains features relevant to the system administrator. TIBCO Collaborative Information Manager Customization Guide: Read this manual to understand how the application can be customized to your enterprise needs. TIBCO Collaborative Information Manager Catalog Rulebase Guide: This manual is a language guide and reference for rulebase. It describes the underlying structure and also provides rulebase examples for definition of rulebase. TIBCO Collaborative Information Manager Workflow Reference: This manual is a reference for automation of business processes. TIBCO Collaborative Information Manager Web Services Guide: This manual is a reference for using web services in the application. TIBCO Collaborative Information Manager Release Notes: Read the release notes for a list of new and changed features. This document also contains lists of known issues and closed issues for this release.

Other TIBCO Product DocumentationYou may find it useful to read the documentation for the following TIBCO products: TIBCO Collaborative Information Manager Process Designer Users Guide: This guide is a reference for designing workflows using the TIBCO Collaborative Information Manager Process Designer graphical user interface.TIBCO Collaborative Information Manager Rulebase Guide

xii

| Related Documentation TIBCO Collaborative Information Manager Process Designer Tutorial: This guide is a tutorial for designing workflows using the TIBCO Collaborative Information Manager Process Designer graphical user interface. TIBCO Collaborative Information Manager Repository Designer Users Guide: This guide is a reference for designing repositories using the TIBCO Collaborative Information Manager Repository Designer graphical user interface. TIBCO Collaborative Information Manager Repository Designer Tutorial: This guide is a tutorial for designing repositories using the TIBCO Collaborative Information Manager Repository Designer graphical user interface. TIBCO Enterprise Message Service software: This software allows the application to send and receive messages using the Java Message Service (JMS) protocol. It also integrates with TIBCO Rendezvous and TIBCO SmartSockets messaging products. TIBCO BusinessWorks software: This is a scalable, extensible and easy to use integration platform that allows you to develop and test integration projects. It includes a graphical user interface (GUI) for defining business processes and an engine that executes the process. TIBCO BusinessConnect software: This software allows your company to send and receive XML or non-XML business documents over the Internet. Based on a mutually agreed process flow and common document format, you and your trading partners can conduct secure and verifiable business transactions online.

TIBCO Collaborative Information Manager Rulebase Guide

Preface xiii

|

Typographical ConventionsThe following typographical conventions are used in this manual. Table 1 General Typographical Conventions Conventioncode font

Use Code font identifies commands, code examples, filenames, pathnames, and output displayed in a command window. For example: Use M y C o m m a n d to start the foo process.

bold code font

Bold code font is used in the following ways: In procedures, to indicate what a user types. For example: Type a d m i n . In large code samples, to indicate the parts of the sample that are of particular interest. In command syntax, to indicate the default parameter for a command. For example, if no parameter is specified, M y C o m m a n d is enabled: MyCommand [e n a b l e | disable]

italic font

Italic font is used in the following ways: To indicate a document title. For example: See TIBCO BusinessWorks Concepts. To introduce new terms For example: A portal page may contain several portlets. Portlets are mini-applications that run in a portal. To indicate a variable in a command or code syntax that you must replace. For example: M y C o m m a n d pathname

Key combinations

Key name separated by a plus sign indicate keys pressed simultaneously. For example: Ctrl+C. Key names separated by a comma and space indicate keys pressed one after the other. For example: Esc, Ctrl+Q. The note icon indicates information that is of special interest or importance, for example, an additional action required only in certain circumstances. The tip icon indicates an idea that could be useful, for example, a way to apply the information provided in the current section to achieve a specific result. The warning icon indicates the potential for a damaging situation, for example, data loss or corruption if certain steps are taken or not taken.

TIBCO Collaborative Information Manager Rulebase Guide

xiv

| How to Contact TIBCO SupportHow to Contact TIBCO SupportFor comments or problems with this manual or the software it addresses, please contact TIBCO Support as follows. For an overview of TIBCO Support, and information about getting started with TIBCO Support, visit this site: http://www.tibco.com/services/support If you already have a valid maintenance or support contract, visit this site: https://support.tibco.com Entry to this site requires a user name and password. If you do not have a user name, you can request one.

TIBCO Collaborative Information Manager Rulebase Guide

|1Chapter 1

Getting Started with Rules

This chapter provides in-depth information for getting started with the TIBCO Collaborative Information Manager Rulebase.

Topics Overview, page 2 Establishing an XML Rules File, page 3 Structure of a Rulebase File, page 5 Header, page 7 Variable Declarations, page 9 Actions, page 18 Global Property Settings for Rules, page 56

TIBCO Collaborative Information Manager Rulebase Guide

2

| Chapter 1

Getting Started with Rules

OverviewA repository consists of a list of records, each with its own set of attributes. Each attribute is defined as being of a particular type and having a certain length. A repository rule allows you to specify more complex constraints on attributes. For example, a repository defines Price as a Number. Using a repository rule, you can specify that this number must be between 0 and 100. You can also specify that, if Price is not zero, another attribute (Currency) must have a specified value. A repository rule is an encapsulated piece of business logic that specifies validations, transformations, and access controls for a record. Some examples are: The storage temperature must be between 20F and 80F. The product effective date must be before the product first ship date. The subclass code must be Chicken, Beef, or Vegetable when the product class code is Soup. Volume is calculated by multiplying height x depth x length. Only Supervisors can access records with Product Code equal to HS.

Repository rules are specified in XML files. Two files can be defined for a repository: New record file called to initialize a new record Validation file called for existing records Search control rules file called from record search.

For detailed information on the XML files, refer to the section , Establishing an XML Rules File, page 3. The XML file of a repository rule consists of a header, variable declarations, and a constraint. The header gives the name and description of the rule. The constraint contains a condition and an action. The condition describes when the rule needs to be applied. The action describes what the rule actually does and controls which attributes the rule is applicable to. For detailed information, refer to the section, Structure of a Rulebase File, page 5.

TIBCO Collaborative Information Manager Rulebase Guide

Establishing an XML Rules File 3

|

Establishing an XML Rules FileFollowing rulebase files can be defined for a repository: New record file called to initialize a new record Validation file called for existing records Search control rules file called from record search.

The new record file is called when adding a new record. Subsequently, the validation file is called when modifying the record. The names of these files are defined using the Configurator. The default names are as follows: InitialConfig > Rule Base > New Record Data Population Rulebase File Name = n e w r e c o r d . x m l InitialConfig > Rule Base > Record Save Validation File Name =catalogvalidation.xml

InitialConfig > Rule Base > Record Search Rules File Name =searchcontrolrules.xml

Do not rename the default rulebase file, c a t a l o g v a l i d a t i o n . x m l , generated by the system. When a repository is created, these files are created in folder$MQ_COMMON_DIR//catalog/master/.

The

can be obtained from the Repository List page.

These validation files are also supported for a relationship catalog. This catalog is created when any relationship attribute is defined for the relationship. The initialization or validation for relationship attributes can be defined in these files. The ID of relationship catalog can be obtained from the database by executing the following SQL:select relationshipcatalogid from relationshipdefinition where o w n e r i d = a n d n a m e = < r e l a t i o n s h i p n a m e > a n d a c t i v e = ' Y

Note: Upload or download of rulebase files through UI is not supported for relationship catalog. For a list of supported actions for a relationship catalog, refer to the Relationship and Multi-value Attributes Vs Regular Attributes section of the TIBCO Collaborative Information Manager Users Guide. The system looks for these files in the following order:

TIBCO Collaborative Information Manager Rulebase Guide

4

| Chapter 1

Getting Started with Rules

1. $MQ_COMMON_DIR//catalog/master/

2.

$MQ_COMMON_DIR/standard/rulebase

The second location is checked only when no file is specified in the first location.

Refer to Chapter 1 of the TIBCO Installation and Configuration Guide for details on MQ_HOME and MQ_COMMON_DIR, under the environment variables section.

New Record FileA new record file is used to assign default values to the attributes of a new record. Assigned values must come from constants or function calls. This file is also used for propagation of attribute values to child records. Some rules from the Validation File also come into play for new records. Drop downs can be filled up only through a constraint in the c a t a l o g v a l i d a t i o n . x m l file.

Validation FileThe validation file usually contains the bulk of the rules. All kinds of rules are applicable: assignments validations propagations access controls

Search Control Rules FileThe search control rules file is used to configure dropdown for attributes on the Record Search screen. Upload or download of this rulebase file through UI is not supported.

TIBCO Collaborative Information Manager Rulebase Guide

Structure of a Rulebase File 5

|

Structure of a Rulebase FileA rulebase file is composed of a header, variable declarations, and a constraint. Header: A rule begins with a header consisting of name, description, error_severity, and threshold. It controls which attributes the rule is applicable to. For more information on the header, refer to the section, Header, page 7. Variable declarations: A list of variable declarations follows the header section. Each declaration section can have the following parts: declare: var:

starts a declaration.

names the variable. contains the data type stored as a t y p e attribute.

datatype: link:

defines a relationship by pointing to data.

For more information on the variable declarations, refer to the section, Variable Declarations, page 9. Constraint: A constraint consists of the following sections. condition section: the condition when the rule needs to be applied. action section: the action that the rule actually takes. For more information on the actions, refer to the section, Actions, page 18. Rules are executed in the order in which they are defined in the rulebase. Sample Here is a sample rulebase that shows the syntax of a rulebase: Sample Rulebase Rulebase that defines all basic constructs CONTAINSREL contains UseCase1 This constraint makes Quantity Field of Contains Relationship view only CONTAINSQUANTITY

TIBCO Collaborative Information Manager Rulebase Guide

6

| Chapter 1

Getting Started with Rules

UseCase2 This constraint provides view only access to records with UOM as EA UOM UOM EA

TIBCO Collaborative Information Manager Rulebase Guide

Header 7

|

HeaderThe header of a rulebase consists of a name, description, error severity, and threshold settings. The header is followed by explicit variable declarations. name, and description The name tag identifies the constraint and the description tag provides a short description of the constraint, as shown in the following example:FirstArrivalDate Validations against First Arrival Date. ... ... ...

The name tag is mandatory and should not contain spaces. The name should be unique across the rulebase. The description tag can contain spaces. severity and threshold Each validation has a severity assigned to it. Each assignment has a level assigned to it. You can set various parameters to control the behavior of the rules depending on these values. The defaults for these values can be set in the header, but they can also be assigned values dynamically in the assignment rules. See, assigns to error severity, warning and information threshold, page 22. element Default 9 Description All validations with severity error_severity are considered warnings. Note: This parameter was previously called . will still work, but it should be renamed to when file is updated. 99 All warnings with severity will return an array of the netweights from all the records pointed at by CONTAINS relationships emanating from the current record. CHILDWEIGHT CONTAINS NETWEIGHT < v a r > C H I L D S T A T U S < / v a r > will return an array of the status from all the records pointed at by relationships emanating from the current record. CHILDSTATUS CONTAINS STATUS

If you declare a link without the second attribute, you can use the "/" notation to access the attribute, as shown in the following example: CONTAINSREL CONTAINS ... CONTAINSREL/STATUS 400

TIBCO Collaborative Information Manager Rulebase Guide

Variable Declarations 13

|

multi_relationship_record The multi_relationship_record link follows a chain of relationships and retrieves all the target records. For example, if you have a three level hierarchy of records (product->sku->component), with two relationships (product_sku and sku_component), you can directly retrieve all components for a product by specifying the two relationships in a multi_relationship_record. Argument 1..n Explanation Relationship names

The following is an example of how to use multi_relationship_record links: PRODUCT_COMPONENT PRODUCT_TO_SKU_REL SKU_TO_COMPONENT_REL ProductFlammableFlag If any component has a flammable flag set, then set the flammable flag of the product RECORD_TYPE PRODUCT Y PRODUCT_COMPONENT/COMPONENT_FLAMMABLE_FLAG PRODUCT_FLAMMABLE_FLAG Y PRODUCT_FLAMMABLE_FLAG N

TIBCO Collaborative Information Manager Rulebase Guide

14

| Chapter 1

Getting Started with Rules

Another use of the multi_relationship_record is to access all siblings of a particular child record. For example, when writing a constraint for a SKU, you might want to check that the UOM for the SKU is unique. To retrieve all other SKUs in the product, we first traverse the relationship from the SKU to the PRODUCT and then back down to all the SKUs. SKU_SIBLING SKU_TO_PRODUCT_REL PRODUCT_TO_SKU_REL SKUDistinctUOM UOM of SKUs must be unique. UOM RECORD_TYPE SKU Uom of SKU must not be the same. SKU_SIBLING/UOM SKU_SIBLING/UOM

TIBCO Collaborative Information Manager Rulebase Guide

Variable Declarations 15

|

relationship A relationship link retrieves relationship specific attributes from a target. If no attribute is specified, a relationship object is returned. Relationship attributes can be retrieved using "/" notation. Argument 1 2 Explanation Relationship name Relationship specific attribute (optional)

The following example returns a relationship object and quantity: RelationshipQuantity CONTAINS QUANTITY CONTAINSREL

will be an array of all the Contains relationships emanating from the current record.

CONTAINSREL Contains

You can then access the Quantity for those relationships as in: CONTAINSLINK Contains RollUpGrossWeight Roll-up GrossWeight times Quantity. GROSSWEIGHT CONTAINSREL/QUANTITY CONTAINSLINK/GROSSWEIGHT

TIBCO Collaborative Information Manager Rulebase Guide

16

| Chapter 1

Getting Started with Rules

To count the relationships, use the array directly: ContainsCount Count relationships. ContainsCount CONTAINSREL

record This link type points to a list of records. It can be populated by passing the variable name in the usefor clause of softlink action only. After evaluation, this variable points to a list of records. Example: Using link type "record" The following is an example where the variable is populated by passing the variable name in the usefor clause of the softlink action. RECORDS Softlink recordlist Softlink recordlist RECORDS MC1/ID ID

TIBCO Collaborative Information Manager Rulebase Guide

Variable Declarations 17

|

After evaluation, RECORDS will point to a list containing records returned by softlink. datasource, catalog and classification Datasources can be stored in the current organization, or a shared copy can be stored in the T I B C O C I M enterprise. In other words, the rulebase will first look in the current organization, and only if the datasource is not found, it will look in the global T I B C O C I M enterprise. NOTE: Currently, classification links point to a datasource, which has the same name as the classification scheme. Other than that, a classification variable can be treated just like a datasource. For details on datasource, classification and catalog links, refer to section, SQL Expressions, page 60.

TIBCO Collaborative Information Manager Rulebase Guide

18

| Chapter 1

Getting Started with Rules

ActionsThe action specifies what the rule actually does. The action that is executed depends on whether the condition evaluates to TRUE or FALSE. There can be two action tags. One action tag is mandatory, however, the second is optional. The following rules apply to action tag usage: If there is no condition or the condition is TRUE then the first action tag executes. If the condition is FALSE and there is a second action tag then the second action tag executes. If the condition is FALSE and no second action is present then no action executes. If the condition cannot be evaluated because some of the variables are undefined then no action executes.

The types of actions are listed in the following table: Action access assign check clear condition connect disconnect duplicate enum propagate refresh Description Specifies whether an attribute is hidden, read-only, or variable. Assigns a value to a variable. Checks whether the attribute meets a specified constraint. Clears a variable. Determines whether the action is executed or not. Establishes a relationship between accessed records and the record that is being processed. Removes a relationship between records. Checks for record attributes having a duplicate value. Lists values for a drop-down menu. Belongs inside the select tag. Rolls down action to another record. Specifies whether attributes should be refreshed when one of the variables it depends on is changed.

TIBCO Collaborative Information Manager Rulebase Guide

Actions 19

|

Action select slice softlink table usefor

Description Defines a list of values for the attribute in the usefor section. Slices a table into columns. Indicates that a softlink is to be evaluated. References externally defined values. Specifies which attribute a select, softlink, check or access rule applies to, and serves two purposes: Defines which attribute is applicable for the rule Allows the use of the same rule for multiple attributes

You can combine multiple tags in one action. Only one select is allowed (since a value can only have one drop-down option).

assignYou can assign a value to a variable with the assign tag. If the variable is a catalog attribute or relationship attribute, that attribute is also assigned the value. The assignment occurs after the rulebase is executed. If you use the user interface to edit the product data, the post-assignment values dynamically update the screen display attributes. The following is an example of a post-assignment: PRICE 20.56

Although the first tag after the assign must be a variable, the second tag can be any tag that evaluates to a value. In other words, it can be a nested expression or a constant. assign and null values With one exception, assign will not assign a value if the value to be assigned is null. DISCOUNT 0.20 PRICE

TIBCO Collaborative Information Manager Rulebase Guide

20

| Chapter 1

Getting Started with Rules

So if PRICE is null, the result of the mult operation will be null, and no assignment will be made to DISCOUNT. For DISCOUNT to be null, use the following rule: ComputeDiscount Compute Discount PRICE DISCOUNT 0.20 PRICE DISCOUNT

So if price is undefined, the condition is false, and the discount is cleared. Exception for null assign to array variables The exception for null inserts is for variables that are explicitly declared as array datatypes: RECEIVER_ORGANIZATION

In this case even a null value will result in an entry being made into the array. The exception is because arrays are often constructed in parallel to hold tabular data. For example, lets say you want to pass the following values to the workflow: Col1 A B Col2 null D

TIBCO Collaborative Information Manager Rulebase Guide

Actions 21

|

Since the best way to pass this data to other programs is by column, declare two variables Col1 and Col2. Col1 Col2

If null assignments are ignored, this would result in:Col1 = [A, B] Col2 = [D]

A recipient of this data would now not know how to reconstruct the data because Col1 and Col2 are no longer of equal length. To achieve the above result, do not declare the variables as arrays. Col1 Col2

priority Each assign action can have a priority. The value assigned to a variable is that of the highest priority assignment. One use of this is to define a "catch-all" default value at the end of the rulebase, which is assigned if no other value has been assigned to the variable. Priority values can be between -9 and 9. If no value is specified, the priority is 1. LargeSizeDesignator Size greater than 100 is Large. SIZE 100 SIZE_DESIGNATOR LARGE SmallSizeDesignator

TIBCO Collaborative Information Manager Rulebase Guide

22

| Chapter 1

Getting Started with Rules

Size less than or equal to 10 is small. SIZE 10 SIZE_DESIGNATOR SMALL MediumSizeDesignator If not large/small, it must be medium. SIZE_DESIGNATOR MEDIUM

level Each assignment can have a level associated with it and can be used to control display of information messages on UI. All assignment messages with level less than or equal to information_threshold are displayed on the UI. The default value for level is 1. PRICE 20.56

assigns to error severity, warning and information threshold It is possible to assign new values to severity levels and thresholds (for more details, see, severity and threshold, page 7). You can set thresholds based on user profiles or actions. The following is a very basic example to check if "NEW_THRESHOLD" is defined (in actual usage, more specific and relevant conditions would be used). AssignNewInformationThreshold Assign New Information Threshold

TIBCO Collaborative Information Manager Rulebase Guide

Actions 23

|

NEW_THRESHOLD NEW_THRESHOLD

Assigning values to multi-value attributes For multi-value attributes, you can assign constant values using the tag as follows: TestAssign Test assign using sep tag MTEST MTEST redblue

You can also assign values using the input (or local) array variable: TEMP TestAssign2 Assign using input variable MTEST MTEST TEMP

TIBCO Collaborative Information Manager Rulebase Guide

24

| Chapter 1check

Getting Started with Rules

The check action evaluates an expression as TRUE or FALSE. If the expression is true, the attribute is in compliance. If it is false, the check failed and an explanation is shown. GTIN GTIN checks. GTIN REPLACES_GTIN GTIN cannot start with 0980, 0981, 0982, 0983, 0984, 0985, 0986,098, 0988, 0989, 099 GTIN 0 4 0980 0981 0982 0983 0984 0985 0986 0988 0989 GTIN 0 3 098 099

TIBCO Collaborative Information Manager Rulebase Guide

Actions 25

|

severity Each validation can have a severity level. The lower the severity, the more serious the error. For example, a severity level of 2 is more serious than a severity of 4. The severity level interpretation can vary depending on when a rule is executed. It is up to the user to interpret the implication and act accordingly. Severity levels can range from 1 (most critical) to 99 (least critical). Severity is specified as a severity attribute to the check and select tags, as shown in the following example. VOLUME 0

You can specify the level of severity that must be reached for an operation to fail. For example, if you specify the error severity as 4, all validations with severities less than or equal to 4 cause the operation to fail. All other errors appear as warning or information messages.

clearAssign will NOT assign a null value to a variable. In other words, if the value of an assign evaluates to null, no assignment will be done. To clear a variable, use the clear action. Multi-value attributes can also be cleared using clear action.

PRICE

Note: Priorities can also be used for clear. Refer to, Global Property Settings for Rules, page 56 for details on priority.

conditionThe condition determines whether the action is executed or not. The condition should evaluate to TRUE or FALSE or be undefined (evaluate to null). Note that if there is no condition, the action is always executed. The following rules apply: When TRUE, the first action following the condition tag is executed.

TIBCO Collaborative Information Manager Rulebase Guide

26

| Chapter 1

Getting Started with Rules

When FALSE, the second action is executed. When the condition cannot be evaluated, because the variables do not have a value, neither action is executed. If there is no condition, the first action is executed.

The following is an example of condition tag usage: UPC12 Check length of UPC code based on type. UPC UPC_TYPE UN UPC_TYPE UP UPC_TYPE UA UPC_TYPE UD UPC_TYPE UE UPC_TYPE UG For UPC Type UN,UP,UA,UD,UE,UG UPC must have length 12 12

TIBCO Collaborative Information Manager Rulebase Guide

Actions 27

|

For UPC Type not equal to UN,UP,UA,UD,UE,UG UPC must have length 10 10

If UPC_TYPE is not assigned a value, neither action executes because the condition will evaluate to null. The condition code will also convert other values to TRUE or FALSE. Datatype string number TRUE TRUE; YES; T, Y, 1 not 0 FALSE All other non-null values 0

For example, when using the count operator, the two expressions will give the same result: CONTAINSREL 0

and CONTAINSREL

In the second case, if count evaluates to 0, it will automatically be converted to FALSE.

TIBCO Collaborative Information Manager Rulebase Guide

28

| Chapter 1connect

Getting Started with Rules

This action establishes a relationship between accessed records and the record that is being processed. This action will access related records (argument 2) and establish the specified relationship (argument 1) with the specified quantity (argument 3). To filter records based on any repository attribute and to create relationships using a rulebase, use the connect action in conjuction with the softlink action. NOTE: To use connect action with the EvaluateRulebase activity, the name of the relationship specified in the connect constraint must be specified in the relationship name list of the ManageRecordCollection activity. Also, the BundlingOption parameter of the ManageRecordCollection activity must be set to true. Table 2 connect Argument 1 2 Argument Type Literal Var (link type = record) Required? N Y Argument Description Relationship type name using which relationship will be established Variable pointing to a list of record objects. See, record, page 16. 3 4 Literal Var/Const N N Name of the relationship attribute. Value to be assigned to the relationship attribute.

Note: When specifying a relationship attribute, the Literal tag must be followed by the Var/Const tag. Multiple relationship attributes can be passed to the connect action. Example: connect used in conjuction with softlink Let us consider two repositories: CUSTOMER and ADDRESS. The records in these two repositories are related using the customer ID. Let us say, you want to find address records for a particular customer and then create a relationship using a rulebase. To do this, you need to run a SQL query to find the address records which match a given customer ID and then issue a create relationship command. Cconnect sample

TIBCO Collaborative Information Manager Rulebase Guide

Actions 29

|

Place this rulebase in catalogvalidattion.xml ofcatalog to automatically create "Shipping Address". ADDRESSCATALOG ADDRESS STATE/CONFIRMED ADDRESSRECORDS AddressSoftlink Returns ADDRESS records having same CUSTOMERID as thatthe record being processed. ADDRESSRECORDS ADDRESSCATALOG/CUSTOMERID CUSTOMERID AddressConnect Connect Address records using 'Shipping Address' Shipping Address ADDRESSRECORDS TYPE MAILING PREFERRED yes

TIBCO Collaborative Information Manager Rulebase Guide

30

| Chapter 1

Getting Started with Rules

disconnectThis action allows you to remove relationships between records. If any relationship attributes are defined with the relationship, such attributes are also removed. The action accepts a record list and a relationship name. The record list can be generated using: relationship_record link The relationship_record link can be used to get the related records. The filter function can be applied to the relationship_link result to get the required records. For more information on relationship_record link, refer to, relationship_record, on page 12. softlink action The record list can also be populated using the softlink action. However, softlink does not allow you to filter out the related record, and may return unrelated records. For more information on the softlink action, refer to, softlink, on page 42. A sample rulebase is available in$MQ_COMMON_DIR/standard/samples/rulebase/disconnectsample.xml.

Table 3 disconnect Argument 1 2 Argument Type Literal Var (link type = record) Required? Y Y Argument Description Name of the relationship to be removed. Variable pointing to a list of records. See, record, page 16.

Example: Selecting records The relationship_record link can be used to get the related records. The filter function can be applied to the relationship_link result to get the required records. UPSELL_RELATIONSHIP Upsell RECORD_LIST

TIBCO Collaborative Information Manager Rulebase Guide

Actions 31

|

SelectChildren Obtain list of records for disconnect RECORD_LIST UPSELL_RELATIONSHIP SHORTDESC test

Example: disconnect The disconnect action accepts a list of records and relationship name as follows: testDisconnect disconnect RECORD_LIST Contains RECORD_LIST

duplicateThe duplicate action checks for record attributes having a duplicate value. For example, if value of RECORD_TYPE attribute needs to be unique, apply a duplicate check on it. A duplicate check is not supported for multi-value attributes.

TIBCO Collaborative Information Manager Rulebase Guide

32

| Chapter 1

Getting Started with Rules

Let us say, you now add record A with RECORD_TYPE = A. Then, you add record B with RECORD_TYPE = A. An error is displayed. Here is an example of the syntax:duplicateCheck Checking for duplicates. 4 DuplicateRECORDTYPECheck DuplicateRECORDTYPECheck RECORD_TYPE UOM This record type already exists. RECORD_TYPE UOM

enumThe enum tag belongs inside the select tag, and explicitly lists values for a drop-down menu. Multiple values can be specified using the empty sep (separator). The enum tag has two attributes: header, which determines whether the first row of data is the column headers and col, which defines the number of columns in the table. header The header attribute specifies whether the first row of data is the description of the columns or column data. The default if no value is specified is , that is, the first row contains data. header Option Description There are no column names in the data. The first row is a data column. The first row of data contains the column headers.

TIBCO Collaborative Information Manager Rulebase Guide

Actions 33

|

header Option

Description same as

col The number of columns is solely determined by the col attribute, not by the use of the sep tag. When more than two columns are specified, the select tag interprets the first column as the value stored in the database. Each subsequent value is a display value. The following example creates a list of three items, under a header Soup Styles. Soup Styles Classic Chunky Light

The next example creates a list of three items (because novalue is set to "no"). Since showoninput="2", only the second column is displayed in the drop-down: Classic, Chunky, and Light. However, the values stored in the database are CL,CH,LT. The use of col="2" indicates the two sets of values, otherwise the drop-down menu would display all six items. CLClassic CHChunky LTLight

TIBCO Collaborative Information Manager Rulebase Guide

34

| Chapter 1

Getting Started with Rules

propagateYou can propagate changes of the rulebase to other records with the propagate action. In case of cross repository relationships, for propagation to work during add and modify record place rules in the c a t a l o g v a l i d a t i o n . x m l file of the parent repository. For example, if CUSTOMERID attribute of the CUSTOMER repository needs to be propagated to the ADDRESS repository, place the rules in the CUSTOMER repositorys c a t a l o g v a l i d a t i o n . x m l . Also, for propagation to work correctly, first pass must be set to r e q u i r e d . To do this, add the following in the rulebase file:

If you want propagation during add record only, place the rules in the n e w r e c o r d . x m l file of the child record. The propagate tag can be of two types: rulebase or inline. Type: rulebase The following table lists the arguments for propagate of type="rulebase": Argument 1 2 Explanation Relationship variable Rulebase

In the following example, the current record context is passed down as a record CONTAINSLINK variable. CONTAINSLINK custom/rulebase/RollDownStatus

The rulebase is described by a file relative to the environment variable $MQ_COMMON_DIR.

TIBCO Collaborative Information Manager Rulebase Guide

Actions 35

|

Type: inline The following table lists the arguments for propagate of type="inline": Argument 1 2 Explanation Relationship variable Action

In the following example, the current record context is passed down as a record variable called CONTAINSLINK. The LINK/HAZMATFLAG refers to the HAZMATFLAG where the propagate tag was defined. This traverses the CONTAINS link to the child record, and then copies the parent HAZMATFLAG to the child. The end result is a child record with the same HAZMATFLAG value as its parent. CONTAINSLINK HAZMATFLAG LINK/HAZMATFLAG

refreshWhen the user enters a new value in a drop-down list, all attributes that use that value in their computation are refreshed. This refresh involves a trip to the server. Sometimes, however, the benefit of having an updated value does not compensate for the delay incurred in having to wait for that value. If that is the case, the system allows you to set the refresh to no. This means that the attribute is not refreshed when one of the variables it depends on is changed. The attribute can be added to the following tags:

TIBCO Collaborative Information Manager Rulebase Guide

36

| Chapter 1

Getting Started with Rules

Select In the following rule: SubCategorySoup Sub Category for Soup CLASSIFICATIONLEVEL5 CLASSIFICATIONLEVEL4 Soup Classic Chunky Light

The code checks variables that could affect the value of CLASSIFICATIONLEVEL5. In this case, the analysis is:CLASSIFICATIONLEVEL4 -> CLASSIFICATIONLEVEL5

which means that when CLASSIFICATIONLEVEL4 changes, you need to refresh CLASSIFICATIONLEVEL5. With the refresh flag, this is suppressed: SubCategorySoup2 Sub Category for Soup CLASSIFICATIONLEVEL9 CLASSIFICATIONLEVEL8 Soup Classic Chunky Light

TIBCO Collaborative Information Manager Rulebase Guide

Actions 37

|

In this case, when CLASSIFICATIONLEVEL8 changes, there will be no refresh for CLASSIFICATIONLEVEL9. Assignment Assignments work in a similar manner: EnumLookup Lookup based on enum values. TEMPDESCRIPTION TEMPCODE FAFahrenheit CECelsius KAKelvin EAEach CSCase PAPallet

Without the refresh flag, any changes to TEMPCODE will refresh the screen. With the refresh flag, this rule will not trigger a refresh. A change to TEMPCODE could still trigger a refresh if some OTHER rule used it on the right hand side of the assign. In other words, even if only 1 rule out of 10 does not have refresh set to no, it will refresh if the variables in that rule change. Condition The refresh flag on assign and select suppresses the refresh for all variables, including those used in the . However, you might sometimes want to ignore those variables in the but still refresh if a variable in the changed. For this, you can selectively disable the trigger on the . For example:

TIBCO Collaborative Information Manager Rulebase Guide

38

| Chapter 1

Getting Started with Rules

EnumLookup Lookup based on enum values. UOM EACH UOM CASE ATTRIBUTE3 ATTRIBUTE3 FAFahrenheit CECelsius KAKelvin EAEach CSCase PAPallet Will refresh if ATTRIBUTE3 changes, but NOT if UOM changes. Normally, it would refresh if any of the above variables changed.

selectThe select tag is of two types, and specifies a list of values allowed for an attribute: Uses the enum tag to explicitly list out the values that can appear. Uses the table tag to refer to an external source for the values.

In the user interface, the select action is used to construct a drop-down list. For non-interactive loading, it is used to check if an attribute is one of the values allowed in the list. The select action expects a table of values. The first column in the table is assumed to be the value stored in the database. All subsequent values are display values. Although the first column value is stored in the database, the user can choose the columns that are displayed using the showoninput tag.TIBCO Collaborative Information Manager Rulebase Guide

Actions 39

|

novalue The novalue attribute for the select tag specifies whether an empty value appears in the drop-down menu. The attribute options are listed in the following table. The default is . Note: The novalue attribute is not supported in case of multi-value attributes. novalue Option Description The empty value appears as the first value in the list. The empty value appears at the bottom of the list. The empty value does not appear in the list.

novalue and automatic attribute initialization Depending on the novalue attribute, the behavior for automatically assigning values to the attribute is different. novalue=default The attribute is not initialized but remains null. novalue=option During new record creation only, the attribute is assigned the first value in the drop-down list. If the value is set to null after that, it remains null. novalue=no If the attribute value is null, it is always initialized to the first value in the drop-down. In other words, this attribute should never have a null value. This is true both for creation and modification of records.

TIBCO Collaborative Information Manager Rulebase Guide

40

| Chapter 1

Getting Started with Rules

order The order attribute of the select tag specifies the sort order of the dropdown in the rulebase. The sort order can be mentioned as ascending or descending for particular columns in the dropdown. Table 4 Syntax for order attribute Syntax

Sort Details Dropdown is sorted in the ascending order of the first column and descending order of the second column. Dropdown is sorted in the descending order of the first column and the ascending order of the second column. Dropdown is sorted in the descending order of the second column. Option "1" is ignored.

To get the expected results, the correct syntax is:

and not:

The order attribute works only for select of type table.

showoninput The showoninput attribute for the select tag specifies the columns that appear in a multi column drop-down. For example, if your drop-down has 3 columns, you might decide to show only columns 2 and 3, since the first column is the database code, which is not relevant to the user. The default is to show all columns, with column numbers starting at 1. novalue Option Description Show all columns. Show only the second column. Show the first column and the third column. Do not show the second column.

TIBCO Collaborative Information Manager Rulebase Guide

Actions 41

|

sliceThis action allows you to slice a table into columns. Each column is assigned to a different variable. These variables are usually passed into the rulebase for further processing. For example, let us say, a table contains the following rows:PRODUCTKEYID 100 101 102 PRODUCTID 00009000000034 00009000000126 00009000000560 UOM BASE_UNIT_OR_EACH CASE PALLET

Use the slice action as follows: MC1 MC1 ARR_PROD_KEY_ID ARR_PROD_ID ARR_UOM SliceTest Get record keys ARR_PROD_KEY_ID ARR_PROD_ID ARR_UOM MC1/PRODUCTKEYID MC1/PRODUCTID MC1/UOM MC1/RECORD_TYPE MIXES MC1/PRODUCTIDEXT DNB

TIBCO Collaborative Information Manager Rulebase Guide

42

| Chapter 1

Getting Started with Rules

After the slice, you will have the following arrays:ARR_PROD_KEY_ID = [100, 101,102] ARR_PROD_ID = [00009000000034, 00009000000126, 00009000000560] ARR_UOM = [BASE_UNIT_OR_EACH, CASE, PALLET]

softlinkRecords are typically stored in more than one repository. For example, vendors could be stored in one repository and customers in another. However, almost all the time, the records from one repository need to be linked to records in other repositories. The links can be made in two ways: 1. Soft links: That is, links are evaluated every time they are accessed. As data changes, each evaluation can result in different results. There is no permanent binding. 2. Hard links: This is supported for records within the same repository, that is, contains. The softlink action indicates that a soft link is to be evaluated. Modes The softlink action supports two modes: view (display mode) Creates a hyperlink. When the hyperlink is clicked, a query is executed and it returns a list of records matching the selection criteria. record (non-display mode) Executes a query and returns a list of records matching the selection criteria. In addition, it populates a record link variable and the Usefor variable points to the record link variable.

To use softlink action with connect action, set softlink action mode to 'record'.

Softlink definitions with mode=record should precede corresponding connect actions.

TIBCO Collaborative Information Manager Rulebase Guide

Actions 43

|

The following table lists the arguments for softlink: Argument 1 Explanation Link Attribute Required? Y Description The attribute hyperlink that should be shown. For non display operations, this input is ignored. Define the criterion for selection of records. Only supported type will be SQL. Table must contain SQL element.

2

Table

Y

Example In the following example of softlink, the PRICETYPE attribute is linked to one or more records from MASTER3 repository that have the UOM=PACK. MASTER3 MASTER3 PRICETYPE Select possible PriceTypes from Master3 where UOM is PACK PRICETYPE MASTER3/UOM PACK

To fetch the latest records with state CONFIRMED or UNCONFIRMED, declare the catalog link as follows: MASTER3

TIBCO Collaborative Information Manager Rulebase Guide

44

| Chapter 1

Getting Started with Rules

MASTER3 STATE/UNCONFIRMED

tableThe table tag references externally defined values. Option source Description The source attribute defines the location of the source data. A valid value for source is: distinct datasource - See, source="datasource", page 61. sql - See, sql Function, page 66.

The distinct attribute allows you to filter duplicates and display only distinct or unique values from retrieved values. For example, let us say, a city column has the following values: San Francisco Palo Alto San Jose Palo Alto You can ensure that a result set displays only three entries and not four (since Palo Alto appears twice) by specifying the distinct="true" attribute.

order

The order attribute allows you to sort the result set based on the columns specified. The value for order must be specified in the following format.order="[-][,[-],..]"

Where: - indicates descending order specifies column position based on the columns selected.

Multiple columns can be specified separated by comma.

Example The following example selects a distinct countrycode and countryname from the countrycodes datasource sorted by countrycodes: ConstraintToGetCountryCodes

TIBCO Collaborative Information Manager Rulebase Guide

Actions 45

|

Get country codes from COUNTRYCODES COUNTRY COUNTRYCODES COUNTRYCODE COUNTRYNAME

useforThe usefor tag specifies which attribute a , , or rule applies to, and serves two purposes: Defines which attribute is applicable for the rule Allows the use of the same rule for multiple attributes

The actions do not require the use of a tag.

If you use multiple var tags within a usefor tag, the rule applies to each attribute. For example, you could define Boolean values to have a drop-down menu showing TRUE and FALSE (two values) as follows: TrueFalse True or False. HAZMATFLAG RECYCLEDMATERIALS FREIGHTINCFLAG CONSUMER_UNIT ORDERABLE TRUE FALSE

TIBCO Collaborative Information Manager Rulebase Guide

46

| Chapter 1

Getting Started with Rules

The previous rule applies to the following variables: HAZMATFLAG, RECYCLEDMATERIALS, FREIGHTINCFLAG, CONSUMER_UNIT, and ORDERABLE. These variables must be present in the repository. If you refer to usefor variables for which the rule is configured, you can abbreviate the notation using an empty var tag. In the following example, the var tag refers to the GTIN and then REPLACES_GTIN. GTIN GTIN checks. GTIN REPLACES_GTIN GTIN has to be 14 numeric characters. /^\d{14}$/

TIBCO Collaborative Information Manager Rulebase Guide

Access Modes 47

|

Access ModesThe access tag controls viewing, modification, and visibility of the attribute group or an attribute. The access mode does not have a direct effect on the execution of the rule, other than being returned as a directive to the user interface to hide certain elements. Certain access modes apply to the complete record and take precedence over the access modes specified for the attributes and attributes groups of such records. Access modes allow you to control the visibility and access to entire record, an attribute group or an attribute. For access mode specification to work correctly, the names of the attribute and the attribute group must not be the same. Access for multi-value attributes can also be controlled using the access tag. In case of rulebase evaluation with relationship attribute values, the access modifiers on records based on relationship attribute are not applied on the record list. For example, if you try to hide some records from a record list based on their relationship attribute value for a particular relationship, the records are not hidden.

The following table lists the levels of access and their effects. Attribute Effect The attribute or attribute group will not be visible in the UI. Note: Though a repository validation rulebase allows any attribute to be hidden, including required attributes, TIBCO recommends that you do not hide any of the required attributes (such as PRODUCTID) during create and/or modify as this will not allow you to create or modify a record. The attribute or attribute group appears on the screen as read-only. The attribute or attribute group appears on the screen and can be modified by the user.

TIBCO Collaborative Information Manager Rulebase Guide

48

| Chapter 1

Getting Started with Rules

Attribute

Effect This access mode applies to the entire record. The record does not appear in the record list or in relationships. This access mode applies to the entire record. The record appears in the record list, but cannot be modified. Refer to, Restrictions on Record Access Conditions, page 54.

Rules are executed in the order in which they are defined in the rulebase. For this reason, exceptional cases should appear at the top of the file and general cases near the bottom. In other words, as soon as an access mode is assigned to a particular attribute, all subsequent ones will be ignored. Which one is first, of course, depends on the of that rule. Since record level access actions are translated into SQL, some restrictions exist as to which operators can be used. Refer to, Restrictions on Record Access Conditions, page 54. Order of Precedence for Attribute Group Permissions It is recommended that you manage the attribute group permission through one method either the user interface or the Rulebase. When the attribute group permissions are specified in both the places, permissions specified in the user interface take precedence. The order is: 1. Use the Administration > Resource Security menu decide a set of permissions on the attribute groups. If you hide an attribute group using this menu, modifiers cannot be applied in the rulebase. 2. Apply rulebase modifiers on the attribute groups obtained from Administration > Resource Security. HIDE takes precedence irrespective of whether it is set using the Administration > Resource Security menu or the Rulebase. Repository Attributes In the following example, the shipping code is hidden (does not display on the screen), since it is only relevant to the Logistics department. This is an exceptional case and should be defined at the top of the rulebase with a rule defining the defaults following.

TIBCO Collaborative Information Manager Rulebase Guide

Access Modes 49

|

LogisticsOp Show fields for logistics Op ShippingCode ACTIVITY_NAME EnterLogisticInfo DefaultAttributeMode Default attribute values SHIPPING_CODE

Restrictions on Attribute Access Conditions When hiding attributes during Record List displays, the condition will not evaluate any attribute values. The only values that can be used are those based on the SESSION or repository. The reason is that it is not possible to evaluate the attribute access for each record in the list. The results might well be contradictory. Relationship Attributes Relationship attributes can also have their access mode controlled. To define the access mode on the relationship attribute, it is necessary to the relationship first. Two styles of relationship definitions can be used: declaring the relationship attribute in the declaration using the / notation. In most cases, the / style of the definition is more convenient, as the relationship will already be declared.

TIBCO Collaborative Information Manager Rulebase Guide

50

| Chapter 1

Getting Started with Rules

Example The Default rule at the end will only be valid if UOM is undefined. It will provide access when a new record is added. CONTAINSREL Contains CONTAINSQUANTITY Contains Quantity CONTAINEDREL ContainedBy CONTAINEDQUANTITY ContainedBy Quantity IS_SUPERVISOR IsSupervisor User is supervisor if role contains Admin or Supervisor. IS_SUPERVISOR

TIBCO Collaborative Information Manager Rulebase Guide

Access Modes 51

|

Work Supervisor SESSION/USER_ROLES Admin SESSION/USER_ROLES PalletAccess If UOM is PL, access for contains Quantity is modify and access for containedby quantity is view. UOM PL IS_SUPERVISOR CONTAINSQUANTITY CONTAINEDREL/QUANTITY CaseAccess If UOM is CS then access for contains Quantity is hide, containedby Quantity is view. UOM CS IS_SUPERVISOR CONTAINSREL/QUANTITY CONTAINEDQUANTITY EachAccess

TIBCO Collaborative Information Manager Rulebase Guide

52

| Chapter 1

Getting Started with Rules

If UOM is EA, access for contains quantity is view and access for containedby quantity is hide. UOM EA IS_SUPERVISOR CONTAINSQUANTITY CONTAINEDREL/QUANTITY Default Default values (for ADD, for example): access for contains quantity is view and access for containedby quantity is modify. IS_SUPERVISOR CONTAINSREL/QUANTITY CONTAINEDREL/QUANTITY

The following figure shows a pictorial representation of this example.

TIBCO Collaborative Information Manager Rulebase Guide

Access Modes 53

|

Figure 1 Access modes based on UOM

Record Access It is possible to completely hide a record from a user using hide_record access, or restrict a users edit access to a record by using view_record. Take as example the following rulebase definition: rbrecordlistsecurity1 Rulebase to test view and hide record. IS_SUPERVISOR IsSupervisor User is supervisor if role contains Admin or Supervisor. IS_SUPERVISOR Work Supervisor SESSION/USER_ROLES

TIBCO Collaborative Information Manager Rulebase Guide

54

| Chapter 1

Getting Started with Rules

Admin SESSION/USER_ROLES ViewRecordEACH Make certain fields read only. UOM EACH IS_SUPERVISOR HideRecordCASE Make certain fields read only. UOM CASE IS_SUPERVISOR

This rulebase sets the record access to view only if UOM is EACH and hides the record completely if UOM is CASE. Both rules are only active if the user is not a supervisor. Restrictions on Record Access Conditions For performance reasons, the of rules containing record level access actions are converted to SQL in some cases. This means only functions that are translatable into SQL can be used. These include:

TIBCO Collaborative Information Manager Rulebase Guide

Access Modes 55

|

and, or, not, eq, neq, in, lt, leq, gt, geq, defined, undefined Conditions containing expressions other than those listed above will fail. Record Level Access and Composites The child of a composite will take the most restrictive attribute based on its own and that of the root of the composite record. The exception to this is the Record List screen, which shows all child composites, unless they are explicitly hidden.

TIBCO Collaborative Information Manager Rulebase Guide

56

| Chapter 1

Getting Started with Rules

Global Property Settings for RulesThe TIBCO Collaborative Information Manager stores some system wide configuration parameters for rules in the C o n f i g V a l u e s . x m l file. These properties are set using the Configurator.

LogFlagThis parameter produces rulebase execution logs in the $ M Q _ C O M M O N _ D I R / T e m p directory. It should be used for development or debugging only and should not be enabled in a production environment. This parameter can be specified in System Debugging > RuleBase Debug Mode of the Configurator. Below is an example of how to set it to true so a detailed stack trace can be obtained for rule base execution. Log files start with "r b " and end with ". x m l ". Several files can be produced in one go; browse to locate the right file. Table 5 Log Files Prefixrbb1*.xml rbb2*.xml rbb3*.xml

Description First pass of rulebase. Computes propagations. Propagations. Second pass of rulebase. This is the file you need for debugging validations and assignments.

Checking Attribute NamesSetting the Configurator > Miscellaneous > Check Attribute Names parameter to true halts the processing (throw an exception) if an attribute in the rulebase is not present in the repository.