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 ...
随机推荐
- 在Windows驗證網站設定部分匿名存取
最近接連遇到幾次的需求:供內部使用的ASP.NET網站,全站使用Windows驗證,使用者以網域AD帳號登入,但網站包含少數API性質的ASHX.ASPX或MVC Action,提供其他系統呼叫整合. ...
- 105、android:windowSoftInputMode属性详解
activity主窗口与软键盘的交互模式,可以用来避免输入法面板遮挡问题,Android1.5后的一个新特性. 这个属性能影响两件事情: [一]当有焦点产生时,软键盘是隐藏还是显示 [二]是否减少活动 ...
- oracle 导入数据
1.在数据库中建立实例数据库之后,运行cmd 2.键入 imp空格(实例数据库名)/(实例数据库口令)空格file=“拖入数据地址” 比如czt.dmp文件直接拖进去(空格)full=y 3.按ent ...
- 立体匹配:关于OpenCV读写middlebury网站的给定的视差并恢复三维场景的代码
Middlebury是每个研究立体匹配算法的人不可能不使用的网站,Middlebury提供了许多标准的测试库,这极大地推进了立体匹配算法的进展.Middlebury提供的标准库,其计算出的视差保存在后 ...
- 页面设计--Grid列表
Grid列表控件 功能:主要实现Html Table功能,支持多表头.固定表头.固定列.输出.组合查询.编辑功能 优点:可以快速的通过数据集合生成多表头.多样式的列表.通过简单的拖拉实现多层表头. G ...
- java整数类型
1.整数类型:byte占8位,short 占16位,int占32位,long占64位. 2.对于long类型的值,若赋值给的值大于int类型的最大值或小于int型的最小值,则需要在数字后加L或l,表示 ...
- php array函数实例应用
array_diff_key() array_diff_assoc() array_count_values() array_combine() array_column() array_chunk( ...
- WIN7上搭建Windows Phone 8 开发环境——VMware Workstation下Win8 “无法安装Hyper-V, 某个虚拟机监控程序正在运行”问题解决的办法
最近在试着在Windows 7上搭建Windows Phone 8的开发调试环境,使用的是VMware Workstation + Win8 Pro的虚拟环境, 在漫长的WPexpress_full下 ...
- window8.1中用户的管理员权限的提升方法
1.使用命令netplwiz 2.点击确定后出现如下所示的内容,选择待修改的用户 3.然后点击属性,出现如图的内容 在上图中选中管理员左侧的单选按钮便可以了,将当前用户提升为管理员账户.
- Kindle3与亚马逊
喜欢上亚马逊,偶尔会买些免费或极低价格的书,但始终无法把这些书传到“我的”kindle3上,原因是kindle3无法在中国注册,又绕不开DRM,同时经历了换屏.换主板,早已不是原来的kindle了.今 ...