Lotus Notes常用方法_notessession關閉方法_washing2000的博客-程序员秘密

技术标签: date  button  我的收藏  domain  lotus  list  properties  

将日期转换成星期几 

REM "This formula assumes there is default text in the field called Date.";
REM "Otherwise it gives the "Incorrect data type..." error.";

M := @Text(@Weekday(Date));
N := "1" : "2" : "3" : "4" : "5" : "6" : "7";
Days := "Sunday" : "Monday" : "Tuesday" : "Wednesday" : "Thursday" : "Friday" : "Saturday";
DayName := @Replace(M; N; Days);
@Text(Date) + " (" + DayName + ")"

如何计算一个日期在一年中是第几个星期

Some applications require the computation of the week number in a month in which a given date falls. For example, Sunday 02 May 1999 is in the second week while Saturday 01 May 1999 is in the first week.

This formula computes the week number of date value GivenDate:

WeekNumber := @Integer( (@Day(GivenDate) - @WeekDay(GivenDate)+13) /7 )

计算两个日期之间的月数

Date1 := " 07/22/99 ";
Date2 := "12/22/98";
Mnth :=((@Year(@TextToTime(Date2)) - @Year(@TextToTime(Date1))) * 12) + @Month(@TextToTime(Date2)) - @Month(@TextToTime(Date1));
@Abs(Mnth)

如何把数据转换成电话号码格式

phone := @Trim(Field Name);phonestripped :=
@Trim(@Implode(@Explode(@LowerCase(phone); "et- ()./+"); ""));
@If(@Length(phonestripped) = 10; "(" + @Left(phonestripped; 3) + ") " +
@Right(@Left(phonestripped; 6); 3) + "-" + @Right(phonestripped; 4);
phone

将两位的年代转换为四位的年代

a:=[ 1/1/99 ];
@Prompt([ok];"date";@Text(a;"D2") +"/"[email protected](@Year(a)))

另外一种方法是:

@Text(;"D2") +"/"[email protected](@Year())

有时候大家希望修改新邮件来时的提示声音,可以这样做:

1.
notes.ini 文件中增加一行
NewMailTune= ***

比如:NewMailTune=c:/coolsound.wav

2.
保存 notes.ini.
3.
重新启动 Notes 就可以发现新邮件来时的提示声音改为 coolsound 的效果了

如何在程序中限制谁可以运行代理

REM "====================================";
REM "Restricts who can run this agent to those in at least one of the specified role(s). Note that 'Enforce a consistent ACL' must be enabled for @UserRoles to work locally.";
_roles := "[Admin]";

REM "====================================";
_allowedToRunAgents := (_roles = @UserRoles);
@If(_allowedToRunAgents; ""; @Return(@Prompt([OK]; "Launch Agent"; "You are not authorized to run agents on this database. Contact your database administrator if you need to run system agents on this database.")));

REM "The normal agent code follows...";

如何用公式运行 Dos 命令:@Command([Execute]; "C://COMMAND.COM"; "/C DEL C://TEST.TXT")

如何计算两个日期之间的工作日

This formula calculates elapsed working days, excluding Saturday and Sunday, between any two dates ( FromDate and ToDate).

Totaldays := ((FromDate - ToDate) / (3600  * 24)) + 1 ;
Extday :=  @Weekday(FromDate) - 1  + (7 - @Weekday(ToDate));
Totweekday := (Totaldays - Extday) - 2 ;
Totsatsun := (Totweekday / 7) * 2;
Elapsed := Extday + (Totweekday - Totsatsun) ;
FinalElapsed :=  @If(@Left(@Text(Elapsed) ; ".") != "" ;
@Left(@Text(Elapsed + 1) ; ".") ; Elapsed);
FinalElapsed

一段用于 Web login 按钮的代码

Here is the code for a login button for a Web application that permits Anonymous access. Simple create a hidden agent with this LotusScript code. Then use a button to call the agent. For example, if your agent is called "(Login)", you would call it with this formula command:
@Command([ToolsRunMacro]; "(LogIn)")
Set the button to hide-when the username is "Anonymous". Finally, if the application uses frames, you may want to set the button to open in a new window to avoid nesting a frameset within a frameset.
Code
Code for the agent:
Sub Initialize
Dim db As Notesdatabase
Dim session As New NotesSession
Set db = session.CurrentDatabase
Dim servername As New Notesname (db.Server)
Dim vEvaluate As Variant
Dim dbWebPath As String
vEvaluate =Evaluate(|"/"[email protected](@Subset(@DbName;-1);"";"/")+"/";|)
dbWebPath = vEvaluate(0)
Print "[http://" + servername.common + dbWebPath + "?OpenDatabase&login" + "]"
End Sub

@Function.lss 使用方法

The .lss file show a few @functions, which have been implemented in Lotus Script.
any .lss file can referenced in a Lotusscript Library by adding line as shown below to the declarations section of the script library.

%INCLUDE "@function.lss"

这个技巧是用来设置基于 web 的视图的列宽的。
代码:
@Implode(@Explode(Your Field Here); " ")
To elaborate on this concept, if you'd like to make sure just the first two
words appear on the same line, use:
@Implode(@Explode(@Word(MANUFACTURER;" ";1): @Word(MANUFACTURER;" ";2));
" ")
+ " " +
@right(@right(manufacturer; " "); " ")

 

如何实现打开一个表单时隐藏菜单

You can hide the menu bar that is normally displayed with a given form.

While in form design, press Ctrl+Shift++ (hold down Ctrl and Shift, and press the "plus" key). Save the form. This is a toggle key. When pressed, a form property flag called "NoMenus" is placed in $Info.

To disable the no-menu mode, open the the form design, press Ctrl+Shift++ and save the form. This removes the form propery flag "NoMenus" from the $Info field.

The only way to determine the no-menus mode of a form is to manually inspect the contents of the $Info field

如何在视图的列中引入其他视图的列值

Occasionally, it's helpful to be able to create a view column that takes advantage of the calculations already done in other view columns. Let's suppose you have a number in column A, and a number in column B, one or both of which is calculated by a formula in the view column. You want to display their total in column C without having to repeat any complex formulas.

There's a little known feature that will let you do this. In the propeller head tab of the view column properties, there's a field that'll let you enter a column name. For a formula column, Domino Designer will automatically generate a name such as "$5." To use the value from this column in other columns, you need to change this to a name that's a legal variable, e.g. "columnA." After giving names to columns A and B, you can write the formula for column C as follows.
Code
columnA + columnB

时间数组的处理方法:When you need to create a list of dates, based on a begin date and an end date. This is extremely useful when creating calendar views, allowing you to display activities that extend over a single day. Requirements - three fields:
BeginDate

EndDate
DateArray
Place
the code in the query save event, and when the document is saved it will populate the DateArray field with a list of dates.
Dim session As New NotesSession
Dim db As NotesDatabase
Dim workspace As New NotesUIWorkspace
Dim currentdoc As NotesDocument
Dim uidoc As NotesUIDocument
Dim doc As NotesDocument
Set db=session.CurrentDatabase
Set uidoc=workspace.currentdocument
Set doc = uidoc.document
If doc.BeginDate(0) = doc.EndDate(0) Then
doc.DateArray = doc.BeginDate(0)
Else
result = doc.BeginDate(0) & | - | & doc.EndDate(0)
result2 = Evaluate(|@Explode(@TextToTime("| & result & |"))|)
doc.DateArray=result2
End If
Call doc.Save(True, False)

如何校验填写邮件地址的域是否填写正确

domain := @RightBack(Email; ".");
@If(
@Trim(Email) = "" |
[email protected](Email; "@") |
@Length(domain) < 2 | @Length(domain) > 3 |
(@Length(domain) = 3 & @Member(@LowerCase(domain); "com":"edu":"org":"net":"gov":"mil":"int") = 0) |
@Trim(@Left(Email; "@")) = "";
@Failure("A valid Internet e-mail address is required. Please go back to the form to enter or correct the e-mail address."); @Success)

在字符列表中找到字符的位置

Field - List = your input list
Field - FindChar = the thing you're trying to find in the list
Field - Position = multi value field with final position of the characters you're looking for.

Button code used to find the position of all of your characters :

NumInList := @Elements(List);
TargetFindList := @Explode(@Repeat(FindChar + ", " ; NumInList -1) + FindChar);
SeqList := @Text(@TextToNumber(("0":"1":"2":"3":"4":"5":"6":"7":"8":"9") *+("0":"1":"2":"3":"4":"5":"6":"7":"8":"9")));
Seq := @Subset(@Subset(SeqList; -99); NumInList);
AltFindList := List + Seq;
AltTargetFindList := TargetFindList + Seq;
FindPos := @Replace(AltFindList; AltTargetFindList;Seq);
Final := @Trim(@Replace(FindPos;AltFindList;""));
@SetField("Position";@Trim(@Replace(FindPos;AltFindList;"")))

如何在视图中显示RTF中的内容

Have you ever wanted to display the contents of rich text fields in a view? For example:
You want to let your users be able to bold and set the fonts for their comments, but you also want to have these comments appear in a view.

Here's a solution using the @Abstract function. On the form, if the rich text field name is Body, create a hidden, computed text field (for example, call it BodyText) with the following value:

@Abstract( [TextOnly]:[TrimWhite]; 64000 ; "" ; "Body" )

You then can display the Body Text field in views!

如何动态访问其他的数据库

This tip uses the profile extensively or you can create a separate
profile form available in a separate view. The view name is "Profile"
with one column that is sorted. The value shown in the column is the
form name or a default value Profile".

On the profile form create four text fields:
Server
Database
View
Key

On the form you need to recover a list of Keywords that are available
in the second database. Place the following code on the Keyword field
with the following properties set:  

Use Formula for choices

The following properties can be set as required:
Refresh Fields on Keyword Change
Refresh Choices on Document Refresh

In the lookup formula place the following code:

srv:[email protected]("Notes":"NoCache";"";"Profile";"Profile";"ServerName");
db:[email protected]("Notes":"NoCache";"";"Profile";"Profile";"Database");
vw:[email protected]("Notes":"NoCache";"";"Profile";"Profile";"View");
ky:[email protected]("Notes":"NoCache";"";"Profile";"Profile";"Key");
@DbLookup("Notes":"NoCache";srv:db;vw;ky;<fieldname / Columnnumber>)

The last Dblookup can be replaced with a dbcolumn also. The fieldname
/ column number can also be picked up from the profile.

An enhancement to this could be using the profile commands available
also eg.:  

@GetProfileField

 

版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
本文链接:https://blog.csdn.net/washing2000/article/details/186617

智能推荐

CC2530裸机编程-定时器1_cc2530定时器1中断函数_羽墨志的博客-程序员秘密

1. 测试端口LED的配置//以P0_6端口为例#define LED P0_6void Hal_LEDInit(void){ P0SEL &= ~0xC0; //通用IO P0DIR |= 0xC0; //输出模式 LED = 0;//初始状态为灭}2.设置系统主时钟void Hal_SystemClockInit(void){ CLKCONCMD &= ~

信息学奥赛一本通(1136:密码翻译)_橙子教师的博客-程序员秘密

1136:密码翻译时间限制: 1000 ms 内存限制: 65536 KB提交数: 31622 通过数: 14325【题目描述】在情报传递过程中,为了防止情报被截获,往往需要对情报用一定的方式加密,简单的加密算法虽然不足以完全避免情报被破译,但仍然能防止情报被轻易的识别。我们给出一种最简的的加密方法,对给定的一个字符串,把其中从a-y,A-Y的字母用其后继字母替代,把z和Z用a和A替代,其他非字母字符不变,则可得到一个简单的加密字符串。【输入】输入一行,...

使用anaconda安装caffe_chaoliao2466的博客-程序员秘密

  通过 conda 安装 caffe-gpu 和 caffe  一开始直接使用conda安装caffe结果报错。通过不断搜索,最终找到了解决方法:  conda create -n caffe_gpu -c defaults python=3.6 caffe-gpu  或  conda create -n caffe -c defaults python=3.6 caffe...

hadoop-client 创建文件夹权限_chunliu5969的博客-程序员秘密

在使用hadoop client 创建dir的时候发现,权限不是和参数传的权限存在差异。 首先介绍下hadoop client初始化过程。 在config class 中指定加载hadoop-conf.xml @[email protected]

C++程序设计:回文数_回文数c++程序编写_乔卿的博客-程序员秘密

【问题描述】当一个数从前往后写与从后往前写时相等,则该数被称为回文数,所有的个位数都是回文数。所有非回文数通过一系列的操作都可以匹配一个回文数。首先,将该数写反以后与原数相加,判断结果是否为回文数,如果不是,重复上述过程,直到和为回文数为止。例如:对于数67,两步以后可以将其转换为回文数,67+76=143, 143+341=484。给出一个正整数N,请你找出它所匹配的回文数以及它所经历的步骤数。【输入形式】每个输入包含一个测试用例。每个用例包括两正整数n和k,n(&lt;= 1010)是初始数值

nginx 反向代理 ,配置 含自定义header 和php fastcgi_laohu4521的博客-程序员秘密

#user  nobody;worker_processes  1;error_log  logs/error.log;error_log  logs/error.log  notice;error_log  logs/error.log  info;#pid        logs/nginx.pid;events {    worke

随便推点

阮一峰:自适应网页设计(Responsive Web Design)别名(响应式web设计)_aizhanqian5077的博客-程序员秘密

随着3G的普及,越来越多的人使用手机上网。移动设备正超过桌面设备,成为访问互联网的最常见终端。于是,网页设计师不得不面对一个难题:如何才能在不同大小的设备上呈现同样的网页?手机的屏幕比较小,宽度通常在600像素以下;PC的屏幕宽度,一般都在1像素以上(目前主流宽度是1366×768),有的还达到了2像素。同样的内容,要在大小迥异的屏幕上,都呈现出满意的效果,并不是一件容易的事...

mysql分库分表(一)_weixin_30550271的博客-程序员秘密

mysql分库分表参考:https://blog.csdn.net/xlgen157387/article/details/53976153https://blog.csdn.net/clevercode/article/details/50877580https://www.cnblogs.com/phpper/p/6937896.htmlhttps://www.cnb...

操作系统知识点总结_xiaozuo7的博客-程序员秘密

1.进程和线程以及他们的区别进程是对运行时程序的封装, 是系统进行资源调度和分配的基本单位, 实现了操作系统的并发 线程是进程的子任务 是CPU调度和分派的基本单位一个程序至少有一个进程, 一个进程至少有一个线程, 线程依赖于进程而存在进程在执行过程中拥有独立的内存单元, 而多个线程共享进程的内存2.进程间通信的几种方式管道(pipe) 及命名管道(named pipe):...

ros入门真的没有那么难,我一般不说有手就行^_^_ros难么_sirooki的博客-程序员秘密

我本来不相信我能用ubuntu工作的,但事实证明有些东西真的只是你还不会用,还会不断有人问你类似的萌新问题:ubuntu是不是很难啊,ros怎么入门啊。但是大家三岁玩XP电脑的时候也差不多这样的状态我现在写的CSDN不会总结什么系统化的知识,我只是当做日记来记录,方便自己以后查阅也不是专门写给谁看的不要抱太大想法,如果你能够读懂我学到知识,那我们一定是跨越了几十亿人产生了缘分0809更:首先在看一些教程之前,我还是有能力自己装一下linux的。ubuntu官网,click[Download], c

python图像拼接_frank+wang的博客-程序员秘密

图像拼接整体流程根据给定图像/集, 实现特征匹配 通过匹配特征计算图像之间的变换结构 利用图像变换结构, 实现图像映射 针对叠加后的图像, 采用APAP之类的算法, 对齐特征点 通过图割方法, 自动选取拼接缝 根据multi-band bleing策略实现融合RANSAC 求解单应矩阵RANSAC是“RANdom SAmple Consensus(随机抽样一致)”的缩写。它可...

计算机图形学-3D观察与图像渲染流水线-投影全解析_Mr. Water的博客-程序员秘密

本文目标:理清OpenGL在3D观察的整个流程。清楚各个专业术语的含义。对坐标系变幻的数学有所掌握。1 三维观察与观察流程1.1 三维观察与照相观察的对比三维观察过程与使用照相机拍摄照片类似对象定位场景范围成像照相自然景物设定相机位置、方向、相机的正向上方向改变相机焦距大小胶片三维观察三维虚拟场景设置三维观察坐标系选定观察体大小...

推荐文章

热门文章

相关标签