;; | ----------------------------------------------------------------------------- ;; | ss_SSgetXD ;; | ----------------------------------------------------------------------------- ;; | Function : Does an ssget and applies extended entity data check also. ;; | Arguments: 'filtr' - Selection Set filter criteria ;; | Do not give Application Name with 'filtr' ;; | as this is given separately in the last parameter ;; | 'XdChk' - Xdata condition to check ;; | XdChk is in the form '('pos' 'operator' 'value') ;; | where ;; | 'pos' is the position of Xdata (starts with 1) ;; | 'operator' is the comparison operator, can be either ;; | = , < , <= , >= or /= ;; | 'value' is the value to be checked ;; | wildcards can be used for string fields. ;; | If the 'value' parameter is a string ;; | and if the 'operator' is =, a literal ;; | equality check is done else if it is a * ;; | a wildcard match (wcmatch) is preformed. ;; | 'RetFmt' Return Format ;; | 0 - Selection Set ;; | 1 - List containing (ename XdataValue) ;; | ;; | 'AppName' - Application Name to check ;; | Author : (C) Rakesh Rao, Singapore ;; | Return : Selection set matching criteria ;; | Updated : 24 July 1998 ;; | e-mail : rakesh.rao@4d-technologies.com ;; | Web : www.4d-technologies.com ;; | ----------------------------------------------------------------------------- (defun SS_SSgetXD(filtr XdChk RetFmt AppName / ss ss1 ssl _type xd cnt ename entl itm _itm pos Operator value Lst) (setq filtr (LI_CodeStrip filtr (list -3)) filtr (append filtr (list (list -3 (list AppName)))) ss (ssget "_X" filtr) ) (if (= RetFmt 0) (setq ss1 (ssadd)) (setq Lst '()) ) (if ss (progn (setq ssl (sslength ss) cnt 0 pos (nth 0 XdChk) Operator (nth 1 XdChk) value (strcase (nth 2 XdChk)) ) (repeat ssl (setq ename (ssname ss cnt) xd (XD_readX ename AppName) cnt (1+ cnt) ) (if xd (progn (setq itm (nth (1- pos) xd)) (if itm (progn (setq _type (type itm)) (cond ((member _type (list 'REAL 'INT 'LIST)) (if ((eval (read Operator)) itm value) (progn (if (= RetFmt 0) (ssadd ename ss1) (setq Lst (cons (list ename itm) Lst)) ) )) ) ((= _type 'STR) (setq _itm (strcase itm)) (cond ((= Operator "=") (if (equal _itm value) (progn (if (= RetFmt 0) (ssadd ename ss1) (setq Lst (cons (list ename _itm) Lst)) ) )) ) ((= Operator "*") (if (wcmatch _itm value) (progn (if (= RetFmt 0) (ssadd ename ss1) (setq Lst (cons (list ename itm) Lst)) ) )) ) ) ) ) )) )) ) )) (if (= RetFmt 0) (if (> (sslength ss1) 0) ss1 nil) Lst ) )