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 ...
随机推荐
- FS4412系统移植
一.SD启动盘制作 1. 下载SD启动盘的工具 sdfuse_q 2. 插入SD卡,并格式化 (1)查看SD卡:sudo fdisk -l (2)格式化SD卡: sudo mkfs -t vfat / ...
- 使pre的内容自动换行
<pre> 元素可定义预格式化的文本.被包围在 pre 元素中的文本通常会保留空格和换行符.而文本也会呈现为等宽字体. <pre> 标签的一个常见应用就是用来表示计算机的源代码 ...
- Javascript 原型编程初探
创建两个对象独立运行 var PlayTrace = function (interVal,name) { this.interVal = interVal; this.playName = name ...
- android studio 更新 Gradle错误解决方法
Android Studio每次更新版本都会更新Gradle这个插件,但由于长城的问题每次更新都是失败,又是停止在Refreshing Gradle Project ,有时新建项目的时候报 Gradl ...
- [SQL]不知道
--COALESCE --返回其参数中第一个非空表达式. --语法 --COALESCE ( expression [ ,...n ] ) --参数 --expression --任何类型的表达式. ...
- JQuery基础教程:事件(上)
在页面加载后执行任务 之前我们已经知道了$(document).ready()是jQuery基于页面加载执行任务的一种主要方式,但是要知道原生的window.onload事件也可以实现相同的 ...
- GlusterFS特性介绍
下面是GlusterFS的一些特性 规范的接口 GlusterFS服务器与POSIX兼容,使用支持文件扩展属性的磁盘文件系统(如ext4.XFS)来存储磁盘上的数据.同时,可以通过业界标准的访问协议如 ...
- 将U盘分成 启动盘+文件存储区
我看了很多帖子,发现想要将U盘分区的朋友绝大部分是和我一样,想用U盘做成一个启动盘同时兼顾文件存储,分区的目的很简单,就是想将启动部分单独做成一个区,以免在日常的应用中使得启动文件染毒或者误操作造成损 ...
- 第2章 linux文件系统
1.用户和用户组管理 1.1 用户管理常用命令 1.用户账号添加命令useradd或adduser 命令格式:useradd [option] [username] 其中[option]为userad ...
- 洛谷P1613 跑路
P1613 跑路 176通过 539提交 题目提供者该用户不存在 标签倍增动态规划 难度普及+/提高 提交该题 讨论 题解 记录 最新讨论 这个题的数据.. 题意问题 表意 题目描述 小A的工作不仅繁 ...