Cognos Script概述
. VB Like Script(80%相容)
. Object Orient
.无法将Script编译成执行档(exe, dll)
.执行方式需透过Commond Line来执行
example: x:\..\runmac32.exe macro_name.mcx
.Script可以用一般的逻辑控制,及Cognos产品的 OLE Automation
Such as: Impromptu, PowerPlay, Portfolio, Authenicator
Transformer 6.61, Access Manager
程序架构:
Sub Main
…
…
End Sub
宣告变量方式:
Dim Variable_name As Datatype
Global Variable_name As Datatype
Const Variable_name = Value
Dim Variable_name(n) As Datatype
Datatype: Object, Integer, String, Long,….
Script的过程控制
1.If condition Then then_statement [ Else else_statement]
2. If condition Then
statement_block
[ ElseIf expression Then
statement_block]...
[ Else
statement_block ]
End If
3.循环
For counter = start TO end [STEP increment]
[ statementblock ]
[ Exit For ]
[ statementblock ]
Next [ counter ]
4. Do [ { While | Until } condition]
[ statementblock ]
[ Exit Do ]
[ statementblock ]
Loop
Do
[ statementblock ]
[ Exit Do ]
[ statementblock ]
Loop [ { While | Until } condition]
5.Goto Lable_name
6.ON [Local] Error {GoTo label [ Resume Next ] GoTo 0}
其它:
显示讯息对话框
MsgBox prompt$ , [buttons%][ , title$]
批注及说明
使用单引号 ‘,单引号后的文字皆为说明
将数据写入文字文件中
Open filename$ [For mode] [Access access] [lock] As [#] filenumber% [Len = reclen]
Example: Open txtfile for append As #1
写入
Write #filenumber%, [expressionlist]
读出
Get #1,recno,acctno
阅读(1572) | 评论(0) | 转发(0) |