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. EDE,DEDE网站搬家,DEDECMS搬家教程,一看就会

    无聊做个小教程:DEDE搬家,本人提供搬家 先来说下DEDE 大家会安装吧,不多说,看图 一.进入织梦DedeCms的后台备份数据库 步骤:系统 –> 数据库备份/还原 -> 全选有所织梦 ...

  2. 20145305解佳玲 《Java程序设计》第1周学习总结

    教材学习内容总结 第一章 Java平台概论 1.先了解了JAVA的历史 2.Java三大平台:Java SE.Java EE与Java ME 3.Java SE的四个组成部分:JVM.JRE.JDK与 ...

  3. MYSQL C API : mysql_real_connect()

    MYSQL * mysql_real_connect( MYSQL *mysql, const char *host, const char *user, const char *passwd, co ...

  4. [ActionScript 3.0] AS3.0 水面波纹效果

    import flash.geom.Point; import flash.display.BitmapData; import flash.filters.DisplacementMapFilter ...

  5. js解析或获取页面路径归纳

    /** * 当填写参数href后,解析你给的参数,如果为空自动从获取浏览器的地址 *测试路径:>>>http://127.0.0.1:8020/url/index.html?id=1 ...

  6. C - Fractal(3.4.1)

    Description A fractal is an object or quantity that displays self-similarity, in a somewhat technica ...

  7. 十步让你调试mvc源码

    1.下载 mvc 当前版本的源码,地址:http://aspnetwebstack.codeplex.com/SourceControl/latest 2.编译源码,参考:http://www.cnb ...

  8. jmeter做接口测试

    jmeter做接口测试有两种方式: 1. 2.

  9. selenium简介

    Selenium是一个开源的和便携式的自动化软件测试工具,用于测试Web应用程序有能力在不同的浏览器和操作系统运行.Selenium真的不是一个单一的工具,而是一套工具,帮助测试者更有效地基于Web的 ...

  10. 使用python通过selenium模拟打开chrome窗口报错 出现 "您使用的是不受支持的命令行标记:--ignore-certificate-errors

    #在程序前加上这段代码 from selenium import webdriver options = webdriver.ChromeOptions() options.add_experimen ...