顯示具有 Formula 標籤的文章。 顯示所有文章
顯示具有 Formula 標籤的文章。 顯示所有文章

2026年1月6日 星期二

[AP] (formula) System Administration\.Edit SetField modify (int)

 @If(@IsNotMember(@UserRoles; "[SystemManager]"); @Return(""); @Success);

FieldName := @Prompt([OkCancelEdit];  "Field Name"; "Please enter the Field Name want to modify..."; @Success);

FieldValue := @Prompt([OkCancelEdit]; "Field Value"; "Please enter the Field Value (use ; to seperate multiple value)"; @Success);

@SetField(FieldName; @TextToNumber(@Explode(FieldValue; ";")));

SELECT @All

[AP] (formula) System Administration\.Edit SetField modify

 @If(@IsNotMember(@UserRoles; "[SystemManager]"); @Return(""); @Success);

FieldName := @Prompt([OkCancelEdit];  "Field Name"; "Please enter the Field Name want to modify..."; @Success);

FieldValue := @Prompt([OkCancelEdit]; "Field Value"; "Please enter the Field Value (use ; to seperate multiple value)"; @Success);

@SetField(FieldName; @Explode(FieldValue; ";"));

SELECT @All

2015年6月23日 星期二

[AP] dialog檢查欄位

dialog檢查欄位,是否包含某一特殊文字
1.在要檢查的欄位的Input Validation屬性,寫入formula「@If(@Like(tAction;"%;%"); @Failure("Error: DO NOT USE [;] !!"); @Success)
2.套表的屬性,自動更新欄位打勾
這麼一來,就可以在輸入內容案確定後,檢查輸入的內容是否包含「;」。

2015年6月8日 星期一

[AP] @Command( [FileOpenDatabase]

@Command( [FileOpenDatabase]; server : database ; navigator ; solo ; newinstance ; temporary )
This command opens the database in a similar fashion, allowing you to specify the navigator instead of the view alone (the view will be defined by the navigator settings in this case). The solo parameter operates just like the newinstance value in the first example.

2015年4月28日 星期二

[AP] notes計算小數點後位數

公式方法使用 :
使用公式 @text 並配合使用參數  F  固定格式(在小數點右邊第一個數字的位置設定數值)。
EX: tmp 欄位值 為 "1.23198765" 使用公式後取得值會變為"1.23"。
@textToNumber(@text(tmp;"F,2"))

=
=
=

取整數也會有同樣的問題  必需寫成 @Integer(@Round(0.5*0.367;0.00001))


2014年11月7日 星期五

[AP] 判斷編輯權限

'//從系統設定文件來比對可用權限

tCode := "Form-SystemSetup1";
tUserDept := @DbLookup ("";@Subset(@DbName;1):"ap\\sys\\sys0001.nsf";"EngView";@V3UserName ;"Dept_No");
tAllowDept := @DbLookup ("";@DbName;"View-SystemSetup";tCode;"hasDelete_1");
tUserID := @V3UserName;
@If(@IsMember(tUserDept;tAllowDept) | @IsMember(tUserID;tAllowDept) | @Contains(@UserRoles; "[ITM OP.]":"[DBAdmin]");
@False; @True)

@If(SignStatus = "Status2" &
       (@UpperCase(@V3UserName)=@UpperCase(NowSigner) |
       (@IsMember("[TEST OP]";@UserRoles ) |

        @IsMember("[ITM OP]";@UserRoles ))); @False; @True)

2014年10月27日 星期一

[AP] 檢查是否有權限

'//檢查是否有權限
'//運在動作上的隱藏條件

User:=@UpperCase(@V3UserName) ;
TMP1 := @UserRoles ;
Dept:=@DbLookup("";@Subset(@DbName;1):"ap\\sys\\sys0001.nsf";"EngView";@Name([Abbreviate];@UserName);"Dept_No");
@If(@IsMember("[ITM OP.]";TMP1) |
(SignStatus = "Status2" & (@IsMember(User;@UpperCase( NowSigner)))| @IsMember(Dept;Authors)) ; @False; @True)

2014年7月7日 星期一

[AP] 比對部門是否有權限顯示該動作

'//比對部門是否有權限顯示該動作

Dim itemAuthors As NotesItem

'//----------------by 20131122 added--------------------
Set itemAuthors = doc.GetFirstItem ("Authors")
Print "GetEmpInfo(doc.SignerNo(0))(2) = " + Cstr(GetEmpInfo(doc.SignerNo(0))(3))
Call itemAuthors.AppendToTextList(GetEmpInfo(doc.SignerNo(0))(3))
'-------------------------------------------------------------------



tUser := @Name([Abbreviate];@UserName);
tNowSigner := @Name([Abbreviate];NowSigner);
tDeptNo :=@DbLookup("NOTES":"NoCache"; @ServerName:"ap\\sys\\sys0001.nsf";"EngView";tUser;"Dept_No");

@If(SignStatus = "Status2":"Status5" & (tUser = tNowSigner | @IsMember("[QC OP.]"; @UserRoles ) |  @IsMember("[TEST OP.]";@UserRoles)) | (@Contains(Authors; tDeptNo))
;  @False; @True)

2014年1月9日 星期四

[AP] 動作的卡控條件,for判斷各流程點簽核

'//動作的卡控條件,for判斷各流程點簽核

tNowSigner := @Name([Abbreviate];NowSigner);
tCurUser := @Name([Abbreviate];@UserName);
@If(SignStatus = "Status10" & (@IsMember(tCurUser;tNowSigner) | @IsMember("[IQC]";@UserRoles) | @IsMember("[ITM OP.]";@UserRoles)); @False; @True)

2013年11月21日 星期四

[AP] 在page裡,click後若需倒入另一個frameset並關掉原來的視窗

//在page裡,若需倒入另一個frameet並關掉原來的視窗
@SetTargetFrame("Main");
@Command([OpenFrameset]; "SP.FSSubPage001")

//回首頁
@SetTargetFrame("Main");
@Command([OpenFrameset]; "SP.JWFFSHome")

2013年10月30日 星期三

[AP] @Command

●Save
@Command([FileSave])

@PostedCommand([Compose];"Form-Main3")

[AP] lotus formula openview

Hello! I need to do this:

I have one frameset with 3 frames. And I need to open my views in one of this frames.
I need to use action buttons (on view action bar) to open views.

As i found in this forum, there is BIG problem to opening views in the same window. In my case - in the same frame!!!

The LS method uidb.OpenView("ViewFrame") don't work in this case! A LS error occurs: "unabled to use this method in this context".

So i tried to use Formula language:
1. I'v created agent

Triger: OnEvent (AgentListSelection)
Target: None.

Code:

@SetTargetFrame("ViewFrame")
@Command([OpenView]; "MyView")


2. For run agent i use action button with LS code.

Set db = ls.CurrentDatabase
Set agent = db.GetAgent("(OpenView)")
Call agent.Run() 

And again the same error occur: "@Function is not valid in this context"!!! @SetTargetFrame() and @Command([OpenView]) don't work in agent.

I tried to place the same code in view action button:
@SetTargetFrame("ViewFrame")
@Command([OpenView]; "MyView")

In this case this commands work! And view "MyView" opens in frame "ViewFrame"!!!

Of couse i could stop on it. But i need more LS code in action button!!! So i need to do that just using LS or agent! 

[AP] DateComposed

@If(DateComposed >= @Date(2009;2;16;0;0;0) ; "SubForm-InputData1_new";
DateComposed >= @Date(2005;7;12;0;0;0) ; "SubForm-InputData1_Bef200609";
"SubForm-InputData1"

[AP] @Name 用法

UserName = "CN=Mesha lin/O=ChipMos"
@Name([CN]; UserName) = "Mesha Lin"
@Name([ABBREVIATE]; UserName) = "Mesha Lin/ChipMos"
@Name([CANONICALIZE]; UserName) = "CN=Mesha lin/O=ChipMos"

[AP] 檢查是否有某個角色

'//for LotusScript
isRole = Evaluate(|@Contains(@UserRoles; "[ITM OP.]":"[Admin]")|, SourceDoc)
If isRole(0) = 1 Then
'//有權限
else
'//無權限 <>1
end if




'//for formula
@Contains(@UserRolles; "[角色名稱]");
@If(!@Contains(@UserRoles; "[角色名稱]"); @Prompt([ok]; "Warning"; "Error statement"); @Command([EditDocument]));