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. ruby中的reject和reject!

    reject和reject!reject返回不满足代码块的元素数组reject!删除数组中满足代码块的元素 a=[1,2,3,5]a.reject! {|x| x<4}p a #[5] b = ...

  2. [Flex] ButtonBar系列——labelFunction用户提供的函数,在每个项目上运行以确定其标签

    <?xml version="1.0" encoding="utf-8"?> <s:Application xmlns:fx="ht ...

  3. try-catch中的finally块

    finally块定义在catch的最后,只能出现一次. 无论程序是否出错都会执行的快板!无条件执行

  4. 最简的Dubbo例子部署

    dubbo 中包含下面4个核心组件: 生产者.消费者.注册中心.监控中心.   简单部署的模块关系 生产者.消费者 最简版本的Dubbo部署只运行Demo Provider和Demo Consumer ...

  5. Sq server 关于存储过程,触发器的一些理论简述

    http://www.doc88.com/p-2905916227462.html      

  6. 源码解读—Stack

    Stack特性:先进后出.后进先出 java.util.Stack实现了这一数据结构. public  class Stack<E> extends Vector<E>,Sta ...

  7. Node.js上传文件

    var formidable = require('formidable'); var util = require('util'); exports.upload = function(req,re ...

  8. The Ninth Hunan Collegiate Programming Contest (2013) Problem G

    Problem G Good Teacher I want to be a good teacher, so at least I need to remember all the student n ...

  9. jmeter测试手机app

    具体步骤:1.电脑启动jmeter2.jmeter在测试计划新建线程组,在工作台新建http代理服务器3.设置IE代理到本地4.手机wifi设置代理连接到PC5.[启动]jmeter代理服务器6.现在 ...

  10. 浅谈Java的包装类

    一.什么是Java包装类 所谓Java包装类,就是将Java中的8种基本数据类型分别包装成为类的形式.包装类与基本数据类型的对应关系如下表所示. 基本数据类型 包装类 byte Byte short ...