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.

Local string &sFilePrefix; &sFilePrefix = %OperatorId | , ) | "-";

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的更多相关文章

  1. Unity3d导入工程出现错误“Creating unique file”的解决方法

    Unity3d导入工程出现错误“Creating unique file:creating file Temp/tempFile failed.Please ensure there is enoug ...

  2. 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\ ...

  3. oracle rman catalog--ORA-01580: error creating control backup file

    在测试rman catalog时,错误的设置了snapshot路径,报错 RMAN> show snapshot controlfile name; RMAN configuration par ...

  4. Using GUID to generate the unique file name in C#

    GUID, the abbreviation of "Global Unique Identifier", is a unique reference number used as ...

  5. EasyHook Creating a remote file monitor

    In this tutorial we will create a remote file monitor using EasyHook. We will cover how to: 使用EasyHo ...

  6. Unmanaged Exports not creating a .lib file

    别用VS2017!别用VS2017!别用VS2017!去吧.

  7. HDFS分布式文件系统(The Hadoop Distributed File System)

    The Hadoop Distributed File System (HDFS) is designed to store very large data sets reliably, and to ...

  8. 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 [ ...

  9. Rpm Creating Subpackages

    转自:http://ftp.rpm.org/max-rpm/s1-rpm-subpack-spec-file-changes.html Spec File Changes For Subpackage ...

随机推荐

  1. nbIoT基础概念

    1. 物理信道(L1与L2之间) 上行:PRACH.PUSCH 下行:PBCH.PDCCH.PDSCH 2.逻辑信道(L2与L3之间) CCCH.DCCH.DTCH 3.信令(L3与NAS层之间) D ...

  2. [ActionScript 3.0] AS3 Socket安全沙箱策略文件

    当与一个主机建立一个Socket连接时,Flash Player要遵守如下安全沙箱规则: 1.Flash的.swf文件和主机必须严格的在同一个域名,只有这样才可以成功建立连接: 2.一个从网上发布的. ...

  3. [Excel]C#操作Excel(导入导出)

    /// <summary> /// 读取Excel文档 /// </summary> /// <param name="Path">文件名称&l ...

  4. poj 1753 Flip Game

    点击打开链接 Flip Game Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 25674   Accepted: 1109 ...

  5. Python的方法分类

    1.Python的类方法,实例方法,和静态方法 class S(object): def Test(self): print("TEST") @classmethod#类方法 de ...

  6. hadoop配置优化

    yarn-site.xml <property> <name>yarn.nodemanager.resource.memory-mb</name> <valu ...

  7. 502 Bad Gateway什么意思

    http://baike.baidu.com/link?url=U2ijg5T5PG_tTkY67mqfx07co7qGqvMB32rbLwq4S2ThBSRIWWvU76Y0Mb8Z3z6nbViN ...

  8. KSImageNamed-Xcode-master 对项目中图片提供自动提示功能的插件

    .使用介绍: (1)KSImageNamed-Xcode-master的使用 安装该插件后,会对文件中图片进行智能提示.  下载地址:http://yun.baidu.com/s/1qWNkvGK  

  9. windows 测试数据库的连接状况-udl方法

    udl是windows系统上,用于测试数据库的连接状态的测试软件. 使用方法: 1.建立一个空白文本 2.将文件的后缀名更改为*.udl 即可     文件内容一定为空 3.选择windows的“提供 ...

  10. Java将Unix时间戳转换成指定格式日期

    public String TimeStamp2Date(String timestampString, String formats){     Long timestamp = Long.pars ...