当前位置:网站首页>Primavera Unifier 高级公式使用分享

Primavera Unifier 高级公式使用分享

2022-08-11 09:08:00 蚕豆哥

Oracle Primavera Unifier 虽然很强大,但在早期版本中因数据处理比较死板还是有些挺多争议,而高级公式这个功能的的加入一定程度上就提高了数据处理的灵活性,根据一朋友的召唤下,这里简单分享一个案例

(PS. 此功能去年20.12 版本上即已加入)

需求:需要一个字段同时体现工单号及项目编号,且格式为 “工单号 / 项目编号”

拿到这个课题自然而且想到组成这个字段需要3个独立的关键要素,即:

  • 工单号
  • /
  • 项目编号

其中工单号及项目编号显然是手动输入,/ 作为连接符 可以通过一个静态的文本写入“ / ”(注意/前后各有一空格)

确认好思路后即准备建立对应的要素,(为方便理解,要素ID直接用了中文拼音)

  • 工单号:QZ_gongdanhao
  • /:PU_lianjiefu_xiegan
  • 项目编号:GC_fenxiangbianhao 

针对需要组合的要素使用高级公式

 使用字符串函数 concat(str1, str2)

 需要注意的是concat 只能同时接上两个字符串,因此 concat(工单号,/ )连接后将作为一个新的str再与项目编号会重新组合连接

 进行错误检查,保存关闭,发布BP后 最后效果如下

如此,效果达成!

看到这里,可以发现,使用固定公式是需要具备一定的IT开发基础,否则可能想不到是用concat来实现该功能,不过有总比没有的强

... 

当然,还有其他公式也是使用类似的方法,相信如果你具备JAVA基础基本都难不倒你

以下是我从ORACLE HELP 搜寻的对应内容(基于 Unifier uDesigner User Guide Version 21)

搜索关键词:Advanced Formulas

核心内容已贴上,如下,希望对感兴趣的你有所帮助

 String 字符串类别

FunctionTooltip
(indexOf(String, int))Starting point of a string within another string starting at a defined point in the string.
(indexOf(String))Starting point of a string within another string starting at the beginning of the string.
(length())Length of a string.
Formating a numeric field to a string, for example: numeric value of 9 with a format of "00000.00" would result in a string of "00009.00".
(startsWith(String, int))Checking to ensure if a string starts within a defined string starting from a defined index. Needs to support indexOf.
(startsWith(String))Checking to ensure if a string starts within a defined string.
(endsWith(String))Checking to ensure if a string ends with a defined string.
(substring(int))Pulling a substring from another string starting at a defined point till the end. This needs to support indexOf.
(substring(int, int))Pulling a substring from another string starting at a defined point till a defined point in the string. This needs to support indexOf.
(concat(String))Concatenating stings including being able to define numeric fields as strings.
(contains(String))Checking to ensure if a string contains another string.
Comparing stringsNot available.

 Numeric 数字类别

FunctionTooltip
(toString(format))Converting a number or currency to a string with a defined format.
(abs())Absolute value of a number
(sqrt())Square root of a number.
(power(int))Raised to the power.
(log())Logarithm Base 10.
(ln())Natural Logaritm.
(min(number, ….))Minimum of a set of numbers.
(max(number, ….))Maximum of a set of numbers.
(ceil())Round up to the smallest integer that is greater than or equal to the value of the field.
(floor())Round down to the largest integer that is less than or equal to the value of the field.
(round(int))Round to the number of decimal places.
Comparingnumbers =, !=, >, >=, <, <=Not available.

补充 详细功能

String FunctionsNumeric FunctionsDate Functions
compare(str1,str2)abs(num)date(year,month,day)
compareIgnoreCase(str1,str2)max(num1,num2)day(date)
concat(str1,str2)min(num1,num2)edate(date,months)
contains(str,search)ceil(num)eomonth(date,months)
containsAny(str,search1,search2,...)floor(num)month(date)
containsIgnoreCase(str,search)log(num)now()
endsWith(str,suffix)log10(num)today()
endsWithIgnoreCase(str,suffix)pow(base,exponent)weekday(date)
indexOf(str,search)round(num,places)weeknum(date)
indexOfAny(str,search1,search2,...)sqrt(num)year(date)
indexOfIgnoreCase(str,search)isNumber(num)addDays(date,amount)
isAlpha(str)numberFormat(num,pattern)addHours(date,amount)
isBlank(str)toDouble(num)addMonths(date,amount)
isEmpty(str)toInt(num)addWeeks(date,amount)
isNumeric(str)toLong(num)addYears(date,amount)
isNumericSpace(str)cos(num)dateDiff(start,end)
lowerCase(str)sin(num)dateFormat(date,pattern)
upperCase(str)tan(num)isSameDay(date1,date2)
matches(str,regex)acos(num)toLong(date)
left(str,len)asin(num)toDate(long)
leftPad(str,size)atan(num) 
leftPad(str,size,padStr)cosh(num) 
mid(str,pos,len)sinh(num) 
right(str,len)tanh(num) 
rightPad(str,size)  
rightPad(str,size,padStr)  
replace(str,search,replacement)  
replaceAll(str,regex,replacement)  
replaceFirst(str,regex,replacement)  
startsWith(str,prefix)  
startsWithIgnoreCase(str,prefix)  
size(str)  
strip(str)  
substring(str,start)  
substring(str,start,end)  
truncate(str,maxlen)  

以上只是一个高级公式运用示例,如有其他场景运用无法实现/或不知无法实现可向我咨询。

 这个行业的分享不多,希望更多感兴趣的朋友一同参与,探讨或合作 !

本人可提供Oracle 多种产品技术服务,包括产品的部署和维护及培训,欢迎与我取得联系!
如何联系蚕豆哥_蚕豆哥的博客-CSDN博客电邮:[email protected] (@gmail.com,@outlook.com)https://campin.blog.csdn.net/article/details/52950969

原网站

版权声明
本文为[蚕豆哥]所创,转载请带上原文链接,感谢
https://campin.blog.csdn.net/article/details/126216317