当前位置: 首页 > news >正文

Calling PeopleTools APIs 调用PeopleTools API

Calling PeopleTools APIs
调用PeopleTools API

You can call all of the PeopleTools APIs from an Application Engine program. When using APIs, remember that:

您可以从应用程序引擎程序调用所有PeopleTools API。使用API时,请记住:

  • All the PeopleTools APIs contain a Save method.
  • 所有PeopleTools API都包含一个Save方法。

However, when you call an API from your Application Engine program, regardless of the Save method of the API, the data is not saved until the Application Engine program issues a commit.

但是,当您从应用程序引擎程序调用API时,无论API的Save方法如何,数据都不会保存,直到应用程序引擎程序发出提交。

  • If you called a component interface from an Application Engine program, all the errors related to the API are logged in the PSMessage collection associated with the current session object.
  • 如果您从应用程序引擎程序调用组件接口,所有与API相关的错误都会记录在与当前会话对象关联的PSMessage集合中。
  • If you sent a message, errors are written to the message log and the Application Engine message log.
  • 如果您发送了消息,错误将写入消息日志和应用程序引擎消息日志。
  • If an Application Engine program called from a message subscription PeopleCode encounters errors and the program exits (with Exit (1)), the error is written to the message log and is marked as an error
  • 如果从消息订阅PeopleCode调用的应用程序引擎程序遇到错误并且程序退出(使用Exit(1)),则错误将写入消息日志并标记为错误
Using the CommitWork Function
使用CommitWork函数

This function commits pending changes (inserts, updates, and deletes) to the database. When using CommitWork, remember that:

此函数向数据库提交挂起的更改(插入、更新和删除)。使用Commit Work时,请记住:

  • This function can be used only in an Application Engine program that has restart disabled.
  • 此功能只能在已禁用重新启动的应用程序引擎程序中使用。
  • The CommitWork function is useful only when you are processing SQL one row at a time in a single PeopleCode program, and you need to commit without exiting the program.
  • CommitWork函数只有当您在单个PeopleCode程序中一次处理一行SQL,并且您需要在不退出程序的情况下提交时才有用。

In a typical Application Engine program, SQL commands are split between multiple Application Engine actions that fetch, insert, update, or delete application data. You use the section or step level commit settings to manage the commits.

在典型的应用程序引擎程序中,SQL命令在多个获取、插入、更新或删除应用程序数据的应用程序引擎操作之间拆分。使用节或步骤级别提交设置来管理提交。

Related Links

“CommitWork” (PeopleCode Language Reference)

相关链接"CommitWork"(PeopleCode语言参考)

Calling WINWORD Mail Merge

调用WINWORD邮件合并

If the Process Scheduler is booted using a shared drive on another machine and you intend to call a WINWORD mail merge process from Application Engine, then you must do one of the following to ensure successful completion:

如果进程计划程序是使用另一台计算机上的共享驱动器启动的,并且您打算从应用程序引擎调用WINWORD邮件合并进程,则必须执行以下操作之一以确保成功完成:

  1. Configure the Process Scheduler to run Application Engine programs using psae instead ofpsaesrv.

将进程调度程序配置为使用psae而不是psae srv运行应用程序引擎程序。

  1. Ensure the generated document is saved locally, not on a shared network drive.

确保生成的文档保存在本地,而不是共享的网络驱动器上。

Using PeopleCode Examples 使用PeopleCode示例

The following topics provide examples of common ways that you can use PeopleCode within Application Engine programs.

以下主题提供了在应用程序引擎程序中使用PeopleCode的常用方法的示例。

Do When Actions

Do When 操作

Instead of a Do When action that checks a %BIND value, you can use PeopleCode to perform the equivalent operation. For example, suppose the following SQL exists in your program:

与检查%BIND值的Do When操作不同,您可以使用PeopleCode执行等效的操作。例如,假设您的程序中存在以下SQL:

%SELECT(EXISTS) SELECT 'Y' FROM PS_INSTALLATION WHERE %BIND(TYPE) = 'X'),

Using PeopleCode, you could insert this code:

使用PeopleCode,您可以插入以下代码:

If TYPE = 'X' Then

   Exit(0);

Else

   Exit(1);

End-if;

If you set the On Return parameter on the PeopleCode action properties to Skip Step, this code behaves the same as the Do When action. The advantage of using PeopleCode is that no trip to the database occurs.

如果将PeopleCode操作属性上的On Return参数设置为Skip Step,则此代码的行为与Do When操作相同。使用PeopleCode的优点是不会发生对数据库的访问。

Dynamic SQL

动态SQL

If you have a Select statement that populates a text field with dynamic SQL, such as the following:

如果您有一个Select语句,该语句使用动态SQL填充文本字段,如下所示:

%SELECT(AE_WHERE1)

SELECT 'AND ACCOUNTING_DT  <= %Bind(ASOF_DATE)'

You can use this PeopleCode:

您可以使用此PeopleCode:

AE_WHERE1 = "AND ACCOUNTING_DT  <= %Bind(ASOF_DATE)";

Sequence Numbering

序列编号

If you typically use Select statements to increment a sequence number inside of a Do Select, While, or Until loop, you can use the following PeopleCode instead:

如果您通常使用Select语句在Do Select、While或Until循环内递增序列号,则可以改为使用以下PeopleCode:

SEQ_NBR = SEQ_NBR + 1;

Using PeopleCode rather than SQL can affect performance significantly. Because the sequencing task occurs repeatedly inside a loop, the cost of using a SQL statement to increment the counter increases with the volume of transactions your program processes. When you are modifying a program to take advantage of PeopleCode, the areas of logic you should consider are those that start with steps that run inside a loop.

使用PeopleCode而不是SQL会显著影响性能。因为定序工作在循环内重复发生,所以使用SQL陈述式递增计数器的成本会随程式处理的交易量而增加。当您修改程序以利用PeopleCode时,您应该考虑的逻辑区域是那些以在循环中运行的步骤开始的逻辑区域。

Note: You can also use the meta-SQL constructs %Next and %Previous when performing sequence numbering. These constructs may improve performance in both PeopleCode and SQL calls.

附注:您还可以使用元SQL构造%执行序列编号时,选择Next和%Previous。这些构造可以提高PeopleCode和SQL调用的性能。

Rowsets

行集

You can use rowsets in Application Engine PeopleCode; however, using rowsets means you will be using PeopleCode to handle more complicated processing, which degrades performance.

您可以在应用程序引擎PeopleCode中使用行集;但是,使用行集意味着您将使用PeopleCode处理更复杂的处理,这会降低性能。

相关文章:

  • GPU和CPU的联系和区别是什么,各自有什么特点,
  • Java基准测试工具JMH的简介与使用
  • Day45:300.最长递增子序列、674. 最长连续递增序列、718. 最长重复子数组
  • Node.js下载安装及配置镜像源
  • vivo开发者链接
  • 机器学习/sklearn 笔记:K-means,kmeans++,MiniBatchKMeans,二分Kmeans
  • python .pyc文件(字节码文件)(字节码与机器码区别)
  • C++知识点总结(7):玩转高精度除法
  • JAVA后端开发技术报告
  • 【Pytorch】Visualization of Fature Maps(2)
  • electron 问题记录
  • 大数据学习(23)-hive on mapreduce对比hive on spark
  • 性能压测工具:wrk
  • 报错0x0000007b问题解决
  • 【经典小练习】输出文件路径名
  • [原]深入对比数据科学工具箱:Python和R 非结构化数据的结构化
  • 「面试题」如何实现一个圣杯布局?
  • Android Studio:GIT提交项目到远程仓库
  • JavaScript 一些 DOM 的知识点
  • Java读取Properties文件的六种方法
  • Linux快速配置 VIM 实现语法高亮 补全 缩进等功能
  • Redis 懒删除(lazy free)简史
  • Tornado学习笔记(1)
  • 解析带emoji和链接的聊天系统消息
  • 新书推荐|Windows黑客编程技术详解
  • 阿里云API、SDK和CLI应用实践方案
  • 资深实践篇 | 基于Kubernetes 1.61的Kubernetes Scheduler 调度详解 ...
  • ​MPV,汽车产品里一个特殊品类的进化过程
  • $(selector).each()和$.each()的区别
  • (1)(1.19) TeraRanger One/EVO测距仪
  • (2.2w字)前端单元测试之Jest详解篇
  • (27)4.8 习题课
  • (JS基础)String 类型
  • (TipsTricks)用客户端模板精简JavaScript代码
  • (官网安装) 基于CentOS 7安装MangoDB和MangoDB Shell
  • (力扣记录)235. 二叉搜索树的最近公共祖先
  • (论文阅读30/100)Convolutional Pose Machines
  • (企业 / 公司项目)前端使用pingyin-pro将汉字转成拼音
  • (十八)用JAVA编写MP3解码器——迷你播放器
  • (学习日记)2024.04.04:UCOSIII第三十二节:计数信号量实验
  • *(长期更新)软考网络工程师学习笔记——Section 22 无线局域网
  • .desktop 桌面快捷_Linux桌面环境那么多,这几款优秀的任你选
  • .net core webapi Startup 注入ConfigurePrimaryHttpMessageHandler
  • .Net下的签名与混淆
  • /3GB和/USERVA开关
  • @for /l %i in (1,1,10) do md %i 批处理自动建立目录
  • @ModelAttribute注解使用
  • @RequestParam,@RequestBody和@PathVariable 区别
  • [ C++ ] STL_stack(栈)queue(队列)使用及其重要接口模拟实现
  • [202209]mysql8.0 双主集群搭建 亲测可用
  • [BUUCTF 2018]Online Tool(特详解)
  • [C#]winform利用seetaface6实现C#人脸检测活体检测口罩检测年龄预测性别判断眼睛状态检测
  • [C#]扩展方法
  • [C/C++]数据结构 循环队列
  • [C++] sqlite3_get_table 的使用