69 Function to fill list with OpCat objects and for each their list of child OpFunc objects
71 Returns list of OpCat objects
74 transform_types:list=[]
77 oc =
OpCat(
"assignment")
80 f.desc=
"No operation. Use to stop operations in conditional sequence."
84 f.desc=
"Assign a fixed value. Param1: value"
90 f.desc=
"Assign a fixed value equal to the record's index in output set. "
91 f.desc +=
"Param1: optional as integer start index >=0. Default is 0. "
92 f.desc +=
"Application code must supply current record index to exectransform.do_transform. Default = 0. "
93 f.desc +=
"Assigned index = Param1 + current_record_index"
99 f.desc=
"Assigns the value of a referenced source field in the current record. Param1: title of field"
105 f.desc =
"Uses random number generator to produce a value scaled between the minimum and maximum values. "
106 f.desc +=
"Param1: optional as minimum. Default is 0. "
107 f.desc +=
"Param2: optional as maximum. Default is 1. If this is < min then set to min + 1. "
115 f.desc =
"Applies a value from a list using relative frequencies of occurrence for a base value. "
116 f.desc +=
"Param1: relative frequencies of occurrence. Can use any real >0 and will be scaled to sum. "
117 f.desc +=
"Since list, enter delimited by pipe such as 2|7|.5|9 where the second list item "
118 f.desc +=
"occurs 37.8% percent (7/18.5) of the time. "
119 f.desc +=
"Param2: list of values correlated to Param1 frequencies and "
120 f.desc +=
"entered with pipe delimiter like red|green|blue|orange. "
121 f.desc +=
"Param3: optional. If used, either a reference field title to use as source of base value, or a real number 0.0-1.0 . "
122 f.desc +=
"Otherwise, the default is to use a random number."
132 f.desc=
"Assigns a value from a lookup list based on matching values to keys where keys can use wildcards. "\
133 "The match can be made to one, two, or three source fields in the record with field 1 always "\
134 "the current value while fields 2 and 3 are optional if set in Param2. "\
135 "Leave Param2 empty to use only 1 field as the match value. All selected fields must match their "\
136 "respective conditions for a lookup result to be assigned. "\
137 "The lookup dictionary has records each with properties: key1, key2, key3, value "\
138 "depending on how many keys are used which is set by Param1 and Param2. "\
139 "Keys can use front and/or back wildcard (*) like top*, *night, *state* to allow token matching. "\
140 "Param1: title of list that has been pre-loaded into array of lists as part of initialization. "\
141 "Param2: Field 2 title, or fields 2 and 3 titles. If both supplied use pipe to delimit as with field2|field3. "
147 transform_types.append(oc)
149 oc =
OpCat(
"conditional")
152 f.desc=
"If value is empty. Compares current value as string"
156 f.desc=
"If value is not empty. Compares current value as string"
160 f.desc=
"If equals. Compares current value as real number (converted from string) to Param1 "
161 f.desc +=
"(also converted) from string or one of the char_aliases for PI (math.pi) or E (math.e)"
167 f.desc=
"If not equals. Compares current value as real number (converted from string) to Param1 "
168 f.desc +=
"(also converted) from string or one of the char_aliases for PI (math.pi) or E (math.e)"
174 f.desc=
"If greater than or equals. Compares current value as real number (converted from string) "
175 f.desc +=
"to Param1 (also converted) from string or one of the char_aliases for PI (math.pi) or E (math.e)"
181 f.desc=
"If not greater than or equals. Compares current value as real number (converted from string) "
182 f.desc +=
"to Param1 (also converted) from string or one of the char_aliases for PI (math.pi) or E (math.e)"
188 f.desc=
"If greater than. Compares current value as real number (converted from string) "
189 f.desc +=
"to Param1 (also converted) from string or one of the char_aliases for PI (math.pi) or E (math.e)"
195 f.desc=
"If not greater than. Compares current value as real number (converted from string) "
196 f.desc +=
"to Param1 (also converted) from string or one of the char_aliases for PI (math.pi) or E (math.e)"
202 f.desc=
"If less than or equals. Compares current value as real number (converted from string) "
203 f.desc +=
"to Param1 (also converted) from string or one of the char_aliases for PI (math.pi) or E (math.e)"
209 f.desc=
"If not less than or equals. Compares current value as real number (converted from string) "
210 f.desc +=
"to Param1 (also converted) from string or one of the char_aliases for PI (math.pi) or E (math.e)"
216 f.desc=
"If less than. Compares current value as real number (converted from string) "
217 f.desc +=
"to Param1 (also converted) from string or one of the char_aliases for PI (math.pi) or E (math.e)"
223 f.desc=
"If not less than. Compares current value as real number (converted from string) "
224 f.desc +=
"to Param1 (also converted) from string or one of the char_aliases for PI (math.pi) or E (math.e)"
230 f.desc=
"If strings are equal. Compares current value to Param1 as string or one of the char_aliases. "
231 f.desc +=
"You can specify multiple test strings by delimiting with pipe (no spacing) as "
232 f.desc +=
"with Strong|strENGTH|power . "
233 f.desc +=
"Param1: comparison value. "
234 f.desc +=
"Param2: optional whether case sensitive (default is false). "
242 f.desc=
"If strings are not equal. Compares current value to Param1 as string or one of the char_aliases. "
243 f.desc +=
"You can specify multiple test strings by delimiting with pipe (no spacing) as "
244 f.desc +=
"with Strong|strENGTH|power . "
245 f.desc +=
"Param1: comparison value. "
246 f.desc +=
"Param2: optional whether case sensitive (default is false). "
254 f.desc=
"If current value starts with Param1. "
255 f.desc +=
"You can specify multiple test strings by delimiting with pipe (no spacing) as "
256 f.desc +=
"with Strong|strENGTH|power . "
257 f.desc +=
"Param1: comparison value. "
258 f.desc +=
"Param2: optional whether case sensitive (default is false). "
265 f =
OpFunc(
"ifNotStrStarts")
266 f.desc=
"If current value not starts with Param1. "
267 f.desc +=
"You can specify multiple test strings by delimiting with pipe (no spacing) as "
268 f.desc +=
"with Strong|strENGTH|power . "
269 f.desc +=
"Param1: comparison value. "
270 f.desc +=
"Param2: optional whether case sensitive (default is false). "
277 f =
OpFunc(
"ifStrContains")
278 f.desc=
"If current value contains Param1. "
279 f.desc +=
"You can specify multiple test strings by delimiting with pipe (no spacing) as "
280 f.desc +=
"with Strong|strENGTH|power . "
281 f.desc +=
"Param1: comparison value. "
282 f.desc +=
"Param2: optional whether case sensitive (default is false). "
283 f.desc +=
"Param3: optional whether remove all spaces from current value before comparing "
284 f.desc +=
"so 'this is me' becomes 'thisisme' (default is false). "
293 f =
OpFunc(
"ifNotStrContains")
294 f.desc=
"If current value not contains Param1. "
295 f.desc +=
"You can specify multiple test strings by delimiting with pipe (no spacing) as "
296 f.desc +=
"with Strong|strENGTH|power . "
297 f.desc +=
"Param1: comparison value. "
298 f.desc +=
"Param2: optional whether case sensitive (default is false). "
299 f.desc +=
"Param3: optional whether remove all spaces from current value before comparing "
300 f.desc +=
"so 'this is me' becomes 'thisisme' (default is false). "
310 f.desc=
"If current value ends with Param1. "
311 f.desc +=
"You can specify multiple test strings by delimiting with pipe (no spacing) as "
312 f.desc +=
"with Strong|strENGTH|power . "
313 f.desc +=
"Param1: comparison value. "
314 f.desc +=
"Param2: optional whether case sensitive (default is false). "
321 f =
OpFunc(
"ifNotStrEnds")
322 f.desc=
"If current value not ends with Param1. "
323 f.desc +=
"You can specify multiple test strings by delimiting with pipe (no spacing) as "
324 f.desc +=
"with Strong|strENGTH|power . "
325 f.desc +=
"Param1: comparison value. "
326 f.desc +=
"Param2: optional whether case sensitive (default is false). "
334 f.desc=
"If integer. Param1 specifies if must be positive integer, negative, or any. "
335 f.desc +=
"Param1: optional ['any','positive','negative'] default=any"
341 f.desc=
"If not integer. Param1 specifies if must be positive integer, negative, or any. "
342 f.desc +=
"Param1: optional ['any','positive','negative'] default=any"
348 f.desc=
"If real. Param1 specifies if must be positive, negative, or any. "
349 f.desc +=
"Param1: optional ['any','positive','negative'] default=any"
355 f.desc=
"If not real. Param1 specifies if must be positive, negative, or any. "
356 f.desc +=
"Param1: optional ['any','positive','negative'] default=any"
362 f.desc=
"If in ISO DateTime format of yyyyMMdd with optional time part of Thhmmss. "
363 f.desc +=
"Date part may use delimiters / or -. "
364 f.desc +=
"Time part may use delimiter :. Examples: 2024-03-24T14:33:05, 20240324T143305, 20240324"
368 f.desc=
"If not in ISO DateTime format of yyyyMMdd with optional time part of Thhmmss. "
369 f.desc +=
"Date part may use delimiters / or -. "
370 f.desc +=
"Time part may use delimiter :. Examples: 2024-03-24T14:33:05, 20240324T143305, 20240324"
374 f.desc=
"If in supplied date format. Date may use delimiters / or -. "
375 f.desc +=
"Param1: format with MMM for month abbreviation like Jan or Aug, "
376 f.desc +=
"and MONTH for full name like January. "
377 f.desc +=
"Formats: mmddyy, mmdyy,mdyy,mmddyyyy,mmdyyyy,mdyyyy,ddmmyy,ddmyy,dmyy,ddmmyyyy,ddmyyyy,dmyyyy,"
378 f.desc +=
"yymmdd,yymmd,yymd,yyyymmdd,yyyymmd,yyyymd,yyyyddd,yyyyMMMdd,ddMMMyyyy,"
379 f.desc +=
"MONTHdd,yyyy,ddMONTH,yyyy,yyyyMONTHdd,ddMONTHyyyy,yyMONTHdd,ddMONTHyy"
384 f=
OpFunc(
"ifNotDateFormat")
385 f.desc=
"If not in supplied date format. Date may use delimiters / or -. "
386 f.desc +=
"Param1: format with MMM for month abbreviation like Jan or Aug, "
387 f.desc +=
"and MONTH for full name like January. "
388 f.desc +=
"Formats: mmddyy, mmdyy,mdyy,mmddyyyy,mmdyyyy,mdyyyy,ddmmyy,ddmyy,dmyy,ddmmyyyy,ddmyyyy,dmyyyy,"
389 f.desc +=
"yymmdd,yymmd,yymd,yyyymmdd,yyyymmd,yyyymd,yyyyddd,yyyyMMMdd,ddMMMyyyy,"
390 f.desc +=
"MONTHdd,yyyy,ddMONTH,yyyy,yyyyMONTHdd,ddMONTHyyyy,yyMONTHdd,ddMONTHyy"
394 transform_types.append(oc)
396 oc =
OpCat(
"numeric")
398 f=
OpFunc(
"convertMainFrameNumber")
399 f.desc=
"Converts a number in string representation in coded main frame format to string of real number. "
400 f.desc +=
"Encoded last character is indicator of this formatting including sign reversal if necessary. "
401 f.desc +=
"Always makes last 2 digits into decimal portion so no further divide by 100 is necessary. "
402 f.desc +=
"If special char is within input string it becomes the end char and the "
403 f.desc +=
"remaining suffix is discarded. Leading zeros are truncated so 000.12 becomes 0.12 . Codes are:"
404 f.desc +=
"{= 0, }= 0 and negate; "
405 f.desc +=
"a= 1, j= 1 and negate; "
406 f.desc +=
"b= 2, k= 2 and negate; "
407 f.desc +=
"c= 3, l= 3 and negate; "
408 f.desc +=
"d= 4, m= 4 and negate; "
409 f.desc +=
"e= 5, n= 5 and negate; "
410 f.desc +=
"f= 6, o= 6 and negate; "
411 f.desc +=
"g= 7, p= 7 and negate; "
412 f.desc +=
"h= 8, q= 8 and negate; "
413 f.desc +=
"i= 9, r= 9 and negate"
417 f.desc=
"Rounds number to specified number of decimal digits. If "
418 f.desc +=
"number digits=0 (default) then nearest integer made (real datatype ends .00). "
419 f.desc +=
"Midpoint goes to even number."
421 f.param1typ=
"integer"
425 f.desc=
"Returns the largest integral value less than or equal to number. "
426 f.desc +=
"If for a real datatype, will end with .00"
430 f.desc=
"Returns the smallest integral value greater than or equal to number. "
431 f.desc +=
"If for a real datatype, will end with .00"
435 f.desc=
"Returns absolute value"
439 f.desc=
"Inverts sign"
443 f.desc=
"Multiply current value by supplied number. May use special notations. "
444 f.desc +=
"Param1: number for operation"
445 f.desc +=
"Param2: optional boolean whether to clean number of non-numeric prefix and suffix characters. Default is true."
453 f.desc=
"Divide current value by supplied number (current/x). May use special notations. "
454 f.desc +=
"Param1: number for operation. If =0 then result= 9.99 x 10^10 "
455 f.desc +=
"Param2: optional boolean whether to clean number of non-numeric prefix and suffix characters. Default is true."
463 f.desc=
"Divide current value from supplied number (x/current). May use special notations. "
464 f.desc +=
"Param1: number for operation. If =0 then result=0 while if current value=0 then result= 9.99 x 10^10 "
465 f.desc +=
"Param2: optional boolean whether to clean number of non-numeric prefix and suffix characters. Default is true."
473 f.desc=
"Add current value by supplied number. May use special notations. "
474 f.desc +=
"Param1: number for operation"
475 f.desc +=
"Param2: optional boolean whether to clean number of non-numeric prefix and suffix characters. Default is true."
483 f.desc=
"Subtract current value by supplied number (current-x). May use special notations. "
484 f.desc +=
"Param1: number for operation"
485 f.desc +=
"Param2: optional boolean whether to clean number of non-numeric prefix and suffix characters. Default is true."
493 f.desc=
"Subtract current value from supplied number (x-current). May use special notations. "
494 f.desc +=
"Param1: number for operation"
495 f.desc +=
"Param2: optional boolean whether to use cleanNumber before action. Default is true."
503 f.desc=
"Multiply current value by value of referenced field. "
504 f.desc +=
"Param1: source field title"
505 f.desc +=
"Param2: optional boolean whether to use cleanNumber before action. Default is true."
507 f.param1typ=
"string"
513 f.desc=
"Divide current value by value of referenced field (current/ref). "
514 f.desc +=
"If Param1=0 then result= 9.99 x 10^10"
515 f.desc +=
"Param1: source field title"
516 f.desc +=
"Param2: optional boolean whether to use cleanNumber before action. Default is true."
518 f.param1typ=
"string"
524 f.desc=
"Divide current value from value of referenced field (ref/current). "
525 f.desc +=
"If current=0 then result= 9.99 x 10^10"
526 f.desc +=
"Param1: source field title"
527 f.desc +=
"Param2: optional boolean whether to use cleanNumber before action. Default is true."
529 f.param1typ=
"string"
535 f.desc=
"Add current value by value of referenced field. "
536 f.desc +=
"Param1: source field title"
537 f.desc +=
"Param2: optional boolean whether to use cleanNumber before action. Default is true."
539 f.param1typ=
"string"
544 f=
OpFunc(
"subtractByRef")
545 f.desc=
"Subtract current value by value of referenced field (current-ref). "
546 f.desc +=
"Param1: source field title"
547 f.desc +=
"Param2: optional boolean whether to use cleanNumber before action. Default is true."
549 f.param1typ=
"string"
554 f=
OpFunc(
"subtractFromRef")
555 f.desc=
"Subtract current value from value of referenced field (ref-current). "
556 f.desc +=
"Param1: source field title"
557 f.desc +=
"Param2: optional boolean whether to use cleanNumber before action. Default is true."
559 f.param1typ=
"string"
565 f.desc=
"Multiply referenced fields. "
566 f.desc +=
"Param1: first field title"
567 f.desc +=
"Param2: second field title or multiple field titles separated by commas like title2,title3,title4"
568 f.desc +=
"Param3: optional boolean whether to use cleanNumber before action. Default is true."
570 f.param1typ=
"string"
572 f.param2typ=
"string"
578 f.desc=
"Add referenced fields. "
579 f.desc +=
"Param1: first field title"
580 f.desc +=
"Param2: second field title or multiple field titles separated by commas like title2,title3,title4"
581 f.desc +=
"Param3: optional boolean whether to use cleanNumber before action. Default is true."
583 f.param1typ=
"string"
585 f.param2typ=
"string"
591 f.desc=
"Base 10 log of current value. If value<0 then result= -10^10. "
592 f.desc +=
"If datatype is int then result uses FLOOR. "
596 f.desc=
"Base E log of current value. If value<0 then result= -10^10. "
597 f.desc +=
"If datatype is int then result uses FLOOR. "
601 f.desc=
"Base 10 exponential of current value. "
605 f.desc=
"Base E exponential of current value. "
609 f.desc=
"Sets number of decimal places for number. If <=0 then value is truncated to integer. "
610 f.desc +=
"If less than number's decimals, excess digits cut. If greater, decimal places padded right with 0. "
611 f.desc +=
"Param1: integer number of decimal places"
613 f.param1typ=
"integer"
616 f=
OpFunc(
"convertFromExp")
617 f.desc=
"Convert a string representing exponential number into non-exponential number. "
618 f.desc +=
"String will be checked for format n.nnEsnn where n is integer digit, "
619 f.desc +=
"and s is an optional + or -. String can also have front - or be enclosed in parentheses. Examples: "
620 f.desc +=
"1.3E05 converted to 130000, -1.23e-1 converted to -0.123"
622 transform_types.append(oc)
627 f.desc=
"Remove whitespace left (i.e. front) and right (i.e. back)"
631 f.desc=
"Remove whitespace left side (front). "
635 f.desc=
"Remove whitespace right side (back). "
639 f.desc=
"Set to lower case. "
643 f.desc=
"Set to upper case. "
647 f.desc=
"Set to title case. "
651 f.desc=
"Take characters from front of string. "
652 f.desc +=
"Matching part is found in current value and then cut after its first occurrence, "
653 f.desc +=
"such as 'r' for value 'horse' yields 'hor'."
654 f.desc +=
"Param1: string to find match"
656 f.param1typ=
"string"
660 f.desc=
"Take characters from before a string match. "
661 f.desc +=
"Matching part is found in current value and then cut before its first occurrence, "
662 f.desc +=
"such as 'r' for value 'horse' yields 'ho'."
663 f.desc +=
"Param1: string to find match"
665 f.param1typ=
"string"
669 f.desc=
"Take N characters from front of string. "
670 f.desc +=
"Param1: number chars"
672 f.param1typ=
"integer"
676 f.desc=
"Take characters from end of string including match. "
677 f.desc +=
"Matching part is found in current value and then cut at its first occurrence to end, "
678 f.desc +=
"such as 'r' for value 'horse' yields 'rse'."
679 f.desc +=
"Param1: string to find match"
681 f.param1typ=
"string"
685 f.desc=
"Take characters from end of string after the match. "
686 f.desc +=
"Matching part is found in current value and then cut after its first occurrence to end, "
687 f.desc +=
"such as 'r' for value 'horse' yields 'se'."
688 f.desc +=
"Param1: string to find match"
690 f.param1typ=
"string"
694 f.desc=
"Take N characters from end of string. "
695 f.desc +=
"Param1: number chars"
697 f.param1typ=
"integer"
701 f.desc=
"Take characters from middle of string. "
702 f.desc +=
"Matching part is found in current value and then cut after its first occurrence, "
703 f.desc +=
"If Param2 not used, result is after cutting with Param1. "
704 f.desc +=
"If Param2 is used, then initial result is again cut after Param2's occurrence "
705 f.desc +=
"meaning result is string including Param1 and Param2 only. "
706 f.desc +=
"For value 'Semantics' Param1='m' and Param2='c' yields 'mantic'. "
707 f.desc +=
"For value 'mishmash' Param1='ma' and Param2='s' yields 'mas'."
708 f.desc +=
"Param1: string to find match"
709 f.desc +=
"Param2: optional string to find second match"
711 f.param1typ=
"string"
713 f.param2typ=
"string"
717 f.desc=
"Take N characters from middle of string. Result is after cutting at Param1 character index from front of string. "
718 f.desc +=
"If Param2 not used, to end of string. "
719 f.desc +=
"For value 'Semantics' Param1='2' and Param2='6' yields 'mantic' , and "
720 f.desc +=
"for value 'mishmash' Param1='4' and Param2='3' yields 'mas'."
721 f.desc +=
"Param1: integer starting position using 0-based indexing"
722 f.desc +=
"Param2: optional second integer for number of characters to take"
724 f.param1typ=
"integer"
726 f.param2typ=
"integer"
730 f.desc=
"Take 1 character at position (0-based). "
731 f.desc +=
"Param1: number char"
733 f.param1typ=
"integer"
737 f.desc=
"Add string to front of value. "
738 f.desc +=
"Param1: string to add"
740 f.param1typ=
"string"
744 f.desc=
"Adds string to end of value. "
745 f.desc +=
"Param1: string to add"
747 f.param1typ=
"string"
751 f.desc=
"Removes all instances string from value. "
752 f.desc +=
"Param1: string to remove"
754 f.param1typ=
"string"
758 f.desc=
"Replaces all instances string in value. "
759 f.desc +=
"Param1: string to remove. "
760 f.desc +=
"Param2: string to insert"
762 f.param1typ=
"string"
764 f.param2typ=
"string"
768 f.desc=
"Sets value to specific length by cutting or padding characters as needed. "
769 f.desc +=
"Param1: integer character length. "
770 f.desc +=
"Param2: optional side to act on (cut or pad) if existing string is not N chars. "
771 f.desc +=
"Either left (i.e front) or right (i.e. back). Default is right. "
772 f.desc +=
"Param3: optional char to pad with if needed. Default is x. If longer than 1 char only first used."
774 f.param1typ=
"integer"
776 f.param2typ=
"string"
778 f.param3typ=
"string"
780 transform_types.append(oc)
785 f.desc=
"Creates an ISO 8601 DateTime string yyyyMMddThhmmss. "
786 f.desc +=
"Param1: Either today for current date, now for current date and time, or ISO DateTime. "
787 f.desc +=
"Param2: optional for either 'today' or 'now' (ignored when Param1 is ISO dateTime) the number hours timezone offset from UTC (e.g. Dallas TX is -5, Kolkata India is +5.5, New York NY is -4), "
788 f.desc +=
"otherwise the computer's time zone is used so depends on server settings."
790 f.param1typ=
"string"
796 f.desc=
"Converts data in specified format to ISO 8601 date yyyyMMdd. "
797 f.desc +=
"Param1: format with MMM for month abbreviation like Jan or Aug, "
798 f.desc +=
"and MONTH for full name like January. "
799 f.desc +=
"Formats: mmddyy, mmdyy,mdyy,mmddyyyy,mmdyyyy,mdyyyy,ddmmyy,ddmyy,dmyy,ddmmyyyy,ddmyyyy,dmyyyy,"
800 f.desc +=
"yymmdd,yymmd,yymd,yyyymmdd,yyyymmd,yyyymd,yyyyddd,yyyyMMMdd,ddMMMyyyy,"
801 f.desc +=
"MONTHdd,yyyy,ddMONTH,yyyy,yyyyMONTHdd,ddMONTHyyyy,yyMONTHdd,ddMONTHyy"
803 f.param1typ=
"string"
806 f=
OpFunc(
"excelDateNumberToISO")
807 f.desc=
"Converts a date in numeric excel format into ISO8601 yyyymmdd format with "
808 f.desc +=
"fractional days removed. Excel uses "
809 f.desc +=
"number days since January 1, 1900 as its counting base. "
810 f.desc +=
"Example: 44416 = 20210808, 42855 = 20170430"
812 transform_types.append(oc)
813 except RuntimeError
as err:
815 return transform_types