Creating a Unique File Name
If you are working with files or file attachments in PeopleCode, you will typically want to create a unique file name for each user to prevent them from overwriting each others files if files are being stored in the same folder.
Here's a simple piece of PeopleCode that generates a file name prefix with the format OPRID-Date-Time. Note that the date and time formats will be specific to your region.
The Substring(String(%Time), 1, 8) drops the millisecond component of the time stamp (which is 6 digits long). If you want to include the millisecond component, don't perform the Substring. Note also that %Time is the database time not the application server time. If you want the application server time use %PerfTime instead. The application server time %PerfTime might be more accurate for file attachments for example.
If you have a number of files per each user, you might want to consider creating a subdirectory for each each operator ID and placing files in there.
Note that the reason for using Operator IDs is that they have a strict format and don't contain any spaces.
This isn't the case for run control IDs. For example you can create run control IDs like these:
- try saving this \/:*?"<>|
- rm -r -f /
Not the most ideal file names! That is why run control ID is not used in the file prefix.
Creating a Unique File Name的更多相关文章
- Unity3d导入工程出现错误“Creating unique file”的解决方法
Unity3d导入工程出现错误“Creating unique file:creating file Temp/tempFile failed.Please ensure there is enoug ...
- TFS Build Error: CSC : fatal error CS0042: Unexpected error creating debug information file 'xxxx.PDB'
CSC : fatal error CS0042: Unexpected error creating debug information file 'xxxx.PDB' -- 'c:\Builds\ ...
- oracle rman catalog--ORA-01580: error creating control backup file
在测试rman catalog时,错误的设置了snapshot路径,报错 RMAN> show snapshot controlfile name; RMAN configuration par ...
- Using GUID to generate the unique file name in C#
GUID, the abbreviation of "Global Unique Identifier", is a unique reference number used as ...
- EasyHook Creating a remote file monitor
In this tutorial we will create a remote file monitor using EasyHook. We will cover how to: 使用EasyHo ...
- Unmanaged Exports not creating a .lib file
别用VS2017!别用VS2017!别用VS2017!去吧.
- HDFS分布式文件系统(The Hadoop Distributed File System)
The Hadoop Distributed File System (HDFS) is designed to store very large data sets reliably, and to ...
- HDFS relaxes a few POSIX requirements to enable streaming access to file system data
https://hadoop.apache.org/docs/r2.7.2/hadoop-project-dist/hadoop-hdfs/HdfsDesign.html Introduction [ ...
- Rpm Creating Subpackages
转自:http://ftp.rpm.org/max-rpm/s1-rpm-subpack-spec-file-changes.html Spec File Changes For Subpackage ...
随机推荐
- JMeter中3种参数值的传递
小伙伴们在使用JMeter的过程中,肯定会遇到参数值传递的问题,下面来和大家总结下,在使用JMeter做压力测试的时候,常见的3种参数值的传递是怎样的. (一)从CSV文件读取要批量输入的变量 假如我 ...
- 算法库:jpeglib和pnglib安装配置
类似于OpenCV的安装配置.只不过OpenCV有编译好的,而jpeglib和pnglib需要自己编译.其实,若要跟踪OpenCV的源码或要使用OpenCV的扩展包,OpenCV也得自己编译. Ope ...
- NYOJ 123 士兵杀敌4-树状数组的插线求点
士兵杀敌(四) 时间限制:2000 ms | 内存限制:65535 KB 难度:5 描述 南将军麾下有百万精兵,现已知共有M个士兵,编号为1~M,每次有任务的时候,总会有一批编号连在一起人请战(编 ...
- ASP.Net软件工程师基础(四)
1.接口 (1)接口是一种规范.协议,定义了一组具有各种功能的方法(属性.索引器本质是方法). (2)接口存在的意义:多态.多态的意义:程序可扩展性. (3)接口解决了类的多继承的问题. (4)接口解 ...
- 用sql语句生成sqlserver数据库表的数据字典
THEN O.name ELSE N'' END, 表描述 THEN PTB.[value] END,N''), 字段序号=C.column_id, 字段名称=C.name, 字段描述=ISNULL( ...
- iOS 5.0 后UIViewController新增:willMoveToParentViewController和didMoveToParentViewCon[转]
在iOS 5.0以前,我们在一个UIViewController中这样组织相关的UIView 在以前,一个UIViewController的View可能有很多小的子view.这些子view很多时候 ...
- DPdao
hrbust1053 http://acm.hrbust.edu.cn/index.php?m=ProblemSet&a=showProblem&problem_id=1053 #in ...
- DP三角形
Hrbust1038 http://acm.hrbust.edu.cn/index.php?m=ProblemSet&a=showProblem&problem_id=1038 // ...
- 基于Web的企业网和互联网的信息和应用( 1194.22 )
基于Web的企业网和互联网的信息和应用( 1194.22 ) 原文更新日期: 2001年6月21日原文地址: http://www.access-board.gov/sec508/guide/1194 ...
- Oracle数据库(2)
; select ename,empno,deptno from emp where job='CLERK'; select * from emp where comm>sal; select ...