- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
您好,我是 Netezza 的新手,我被要求开发自定义 Java 函数并交付 API。
我的问题是我是否可以根据给定的要求提供解决方案。这是要求。
我有一个表,我们将其命名为 Table1。我必须按行读取表并计算不同的值,当我的值有意义时,我必须将其插入到不同的表中。
只是我需要读取多行,计算多个值,当数据有意义时我可以输出它。
所以我的问题是,是否可以在 Netezza 自定义 Java UDTF 函数中读取多行并输出很少的行?
最佳答案
是的,可以读取n行并输出
没有人帮助我,所以我继续构建了该功能,并且运行良好。
三年后,我被要求分享解决方案。我现在不记得要求了,我也离开公司很久了。所以我粘贴了我编写的600行代码,当时我很天真,可能有更好的方法来做到这一点。如果你能理解它,你就会很幸运。
import java.sql.Timestamp;
import java.util.concurrent.Executor;
import java.util.concurrent.Executors;
import org.netezza.ae.Nzae;
import org.netezza.ae.NzaeApi;
import org.netezza.ae.NzaeApiGenerator;
import org.netezza.ae.NzaeDataTypes;
import org.netezza.ae.NzaeException;
import org.netezza.ae.NzaeMetadata;
import org.netezza.ae.NzaeRecord;
import org.netezza.ae.NzaeUtil;
public class viewResolver {
private static final Executor exec = Executors.newCachedThreadPool();
public static final void main(String[] args) {
try {
mainImpl(args);
} catch (Throwable t) {
System.err.println(t.toString());
NzaeUtil.logException(t, "main");
}
}
public static final void mainImpl(String[] args) {
NzaeApiGenerator helper = new NzaeApiGenerator();
while (true) {
final NzaeApi api = helper.getApi(NzaeApi.FUNCTION);
if (api.apiType == NzaeApi.FUNCTION) {
if (!helper.isRemote()) {
run(api.aeFunction);
break;
} else {
Runnable task = new Runnable() {
public void run() {
try {
viewResolver.run(api.aeFunction);
} finally {
api.aeFunction.close();
}
}
};
exec.execute(task);
}
}
}
helper.close();
}
public static int run(Nzae ae) {
try {
int ret = runReal(ae);
ae.done();
return ret;
} catch (NzaeException ex) {
ex.printStackTrace();
ae.userError(ex.getMessage());
ae.done();
throw ex;
} catch (Throwable ex) {
ex.printStackTrace();
ae.userError(ex.toString());
ae.done();
throw new NzaeException(ex.toString());
}
}
static String acc_id = null;
static String rec_id = null;
static String tuner = null;
static String channel = null;
static String show_name = null;
static String tmsId = null;
static String viewing_type = null;
static String event_type = null;
static String channelFamily = null;
static String ruid = null;
static int suid = 0;
static double timeStarted = 0;
static double timeEnded = 0;
static Timestamp datecreated = null;
static double content_start = 0;
static double content_end = 0;
static String prev_acc_id = null;
static String prev_rec_id = null;
static String prev_tuner = null;
static String prev_channel = null;
static String prev_show_name = null;
static String prev_tmsId = null;
static String prev_viewing_type = null;
static String prev_event_type = null;
static String prev_channelFamily = null;
static String prev_ruid = null;
static int prev_suid = 0;
static double prev_timeStarted = 0;
static double prev_timeEnded = 0;
static Timestamp prev_datecreated = null;
static double prev_content_start = 0;
static double prev_content_end = 0;
public static int runReal(Nzae ae) {
double dvr_time_watched = 0;
double vod_time_watched = 0;
double manual_ffx = 0;
double manual_ffr = 0;
boolean end = false;
double tune_duration = 0;
boolean live_DVR_Flag = false;
final NzaeMetadata meta = ae.getMetadata();
NzaeRecord input = null;
boolean firstRecord = true;
validateInput(meta);
while (!end) {
NzaeRecord output = ae.createOutputRecord();
if (true) {
input = ae.next();
if (input == null) {// checks if no more records
end = true;
// returns the final view
if (prev_timeEnded - prev_timeStarted != 0) {// if final view is tune
tune_duration = prev_timeEnded - prev_timeStarted;
output = setOutput(output, prev_acc_id, prev_rec_id, prev_tuner, prev_channel, prev_show_name,
prev_tmsId, prev_viewing_type, prev_event_type, prev_channelFamily, prev_ruid,
prev_suid, prev_timeStarted, prev_timeEnded, prev_datecreated, 0, 0, tune_duration,
manual_ffx, manual_ffr);
ae.outputResult(output);
}
if (vod_time_watched != 0 || dvr_time_watched != 0 || manual_ffr != 0 || manual_ffx != 0) {
if (!prev_event_type.equalsIgnoreCase("DVR_EOE") && dvr_time_watched != 0) {// if DVR
output = setOutput(output, prev_acc_id, prev_rec_id, prev_tuner, prev_channel,
prev_show_name, prev_tmsId, prev_viewing_type, prev_event_type, prev_channelFamily,
prev_ruid, prev_suid, prev_timeStarted, prev_timeEnded, prev_datecreated,
prev_content_start, prev_content_end, dvr_time_watched, manual_ffx, manual_ffr);
ae.outputResult(output);
} else if (!prev_event_type.equalsIgnoreCase("DVR_EOE") && vod_time_watched != 0) {// if VOD
output = setOutput(output, prev_acc_id, prev_rec_id, prev_tuner, prev_channel,
prev_show_name, prev_tmsId, prev_viewing_type, prev_event_type, prev_channelFamily,
prev_ruid, prev_suid, prev_timeStarted, prev_timeEnded, prev_datecreated,
prev_content_start, prev_content_end, vod_time_watched, manual_ffx, manual_ffr);
ae.outputResult(output);
}
}
continue;
} else {// set variables
if (input.getField(0) != null)
acc_id = input.getField(0).toString();
else
acc_id = null;
if (input.getField(1) != null)
rec_id = input.getField(1).toString();
else
rec_id = null;
if (input.getField(2) != null)
tuner = input.getField(2).toString();
else
tuner = null;
if (input.getField(3) != null)
channel = input.getField(3).toString();
else
channel = null;
if (input.getField(4) != null)
show_name = input.getField(4).toString();
else
show_name = null;
if (input.getField(5) != null)
tmsId = input.getField(5).toString();
else
tmsId = null;
if (input.getField(6) != null)
viewing_type = input.getField(6).toString();
else
viewing_type = null;
if (input.getField(7) != null)
event_type = input.getField(7).toString();
else
event_type = null;
if (input.getField(8) != null)
channelFamily = input.getField(8).toString();
else
channelFamily = null;
if (input.getField(9) != null)
ruid = input.getField(9).toString();
else
ruid = null;
if (input.getField(10) != null)
suid = input.getFieldAsNumber(10).intValue();
else
suid = 0;
if (input.getField(11) != null)
timeStarted = input.getFieldAsNumber(11).doubleValue();
else
timeStarted = 0;
if (input.getField(12) != null)
timeEnded = input.getFieldAsNumber(12).doubleValue();
else
timeEnded = 0;
if (input.getField(13) != null)
datecreated = input.getFieldAsTimestamp(13);
else
datecreated = null;
if (input.getField(14) != null)
content_start = input.getFieldAsNumber(14).doubleValue();
else
content_start = 0;
if (input.getField(15) != null)
content_end = input.getFieldAsNumber(15).doubleValue();
else
content_end = 0;
}
}
if (firstRecord) {
prev_acc_id = acc_id;
prev_rec_id = rec_id;
prev_tuner = tuner;
prev_channel = channel;
prev_show_name = show_name;
prev_tmsId = tmsId;
prev_viewing_type = viewing_type;
prev_event_type = event_type;
prev_channelFamily = channelFamily;
prev_ruid = ruid;
prev_suid = suid;
prev_timeStarted = timeStarted;
prev_timeEnded = timeEnded;
prev_datecreated = datecreated;
prev_content_start = content_start;
prev_content_end = content_end;
firstRecord = false;
}
// ********* if acc id or rec id changes
if (prev_acc_id != null && prev_rec_id != null && prev_acc_id != null && prev_rec_id != null) {
if (!prev_acc_id.equalsIgnoreCase(acc_id) || !prev_rec_id.equalsIgnoreCase(rec_id)) {
if (prev_timeEnded - prev_timeStarted != 0) {// if tune
tune_duration = prev_timeEnded - prev_timeStarted;
output = setOutput(output, prev_acc_id, prev_rec_id, prev_tuner, prev_channel, prev_show_name,
prev_tmsId, prev_viewing_type, prev_event_type, prev_channelFamily, prev_ruid,
prev_suid, prev_timeStarted, prev_timeEnded, prev_datecreated, 0, 0, tune_duration,
manual_ffx, manual_ffr);
ae.outputResult(output);
prev_timeEnded = prev_timeStarted = 0;
setPreviousValues();
tune_duration = 0;
manual_ffr = 0;
manual_ffx = 0;
}
if (dvr_time_watched != 0 || manual_ffr != 0 || manual_ffx != 0) {
if (!prev_event_type.equalsIgnoreCase("DVR_EOE")) {// if DVR
output = setOutput(output, prev_acc_id, prev_rec_id, prev_tuner, prev_channel,
prev_show_name, prev_tmsId, prev_viewing_type, prev_event_type, prev_channelFamily,
prev_ruid, prev_suid, prev_timeStarted, prev_timeEnded, prev_datecreated,
prev_content_start, prev_content_end, dvr_time_watched, manual_ffx, manual_ffr);
ae.outputResult(output);
}
dvr_time_watched = 0;
manual_ffr = 0;
manual_ffx = 0;
setPreviousValues();
live_DVR_Flag = false;
}
if (vod_time_watched != 0 || manual_ffr != 0 || manual_ffx != 0) {
if (!prev_event_type.equalsIgnoreCase("DVR_EOE")) {// if VOD
output = setOutput(output, prev_acc_id, prev_rec_id, prev_tuner, prev_channel,
prev_show_name, prev_tmsId, prev_viewing_type, prev_event_type, prev_channelFamily,
prev_ruid, prev_suid, prev_timeStarted, prev_timeEnded, prev_datecreated,
prev_content_start, prev_content_end, vod_time_watched, manual_ffx, manual_ffr);
ae.outputResult(output);
}
vod_time_watched = 0;
manual_ffr = 0;
manual_ffx = 0;
setPreviousValues();
live_DVR_Flag = false;
}
}
}
// ******** special case tune to DVR
if (viewing_type != null && prev_viewing_type != null)
if ((live_DVR_Flag || prev_viewing_type.equalsIgnoreCase("Tune"))
&& viewing_type.equalsIgnoreCase("DvrEvent")) {
if (tmsId != null)
if (!prev_tmsId.equalsIgnoreCase(tmsId)) {
if (live_DVR_Flag) {
// should change the event name to "Live DVR"
if (!prev_event_type.equalsIgnoreCase("DVR_EOE")) {
output = setOutput(output, prev_acc_id, prev_rec_id, prev_tuner, prev_channel,
prev_show_name, prev_tmsId, "LiveDVR", prev_event_type, prev_channelFamily,
prev_ruid, prev_suid, prev_timeStarted, prev_timeEnded, prev_datecreated,
prev_content_start, prev_content_end, dvr_time_watched, manual_ffx,
manual_ffr);
ae.outputResult(output);
}
dvr_time_watched = 0;
manual_ffr = 0;
manual_ffx = 0;
setPreviousValues();
live_DVR_Flag = false;
}
}
if (tmsId != null)
if (prev_tmsId.equalsIgnoreCase(tmsId))
if (event_type != null && content_start != 0 && content_end != 0) {
live_DVR_Flag = true;
// ******* total play time
if (event_type.equalsIgnoreCase("DVR_PLAY") || event_type.equalsIgnoreCase("DVR_PAUSE")) {
dvr_time_watched += (content_end - content_start);
}
// ********* total ffx time
if (event_type.contains("FWD_START") && !event_type.contains("SKIP")) {
manual_ffx += (content_end - content_start);
}
// ********** total ffr time
if (event_type.contains("FWD_END") && !event_type.contains("SKIP")) {
manual_ffr += (content_end - content_start);
}
}
}
// ******** special case DVR to tune
if (viewing_type != null && prev_viewing_type != null)
if ((live_DVR_Flag || prev_viewing_type.equalsIgnoreCase("DvrEvent"))
&& viewing_type.equalsIgnoreCase("Tune")) {
if (tmsId != null)
if (!prev_tmsId.equalsIgnoreCase(tmsId)) {
if (live_DVR_Flag) {
tune_duration = prev_timeEnded - prev_timeStarted;
output = setOutput(output, prev_acc_id, prev_rec_id, prev_tuner, prev_channel,
prev_show_name, prev_tmsId, "LiveDVR", prev_event_type, prev_channelFamily,
prev_ruid, prev_suid, prev_timeStarted, prev_timeEnded, prev_datecreated, 0, 0,
tune_duration, manual_ffx, manual_ffr);
ae.outputResult(output);
prev_timeEnded = prev_timeStarted = 0;
setPreviousValues();
tune_duration = 0;
manual_ffr = 0;
manual_ffx = 0;
live_DVR_Flag = false;
}
}
if (tmsId != null)
if (prev_tmsId.equalsIgnoreCase(tmsId))
if (timeEnded != 0)
prev_timeEnded = timeEnded;
}
// ***** For Tune events
if (prev_viewing_type.equalsIgnoreCase("Tune")) {
if (tmsId != null)
if (!prev_tmsId.equalsIgnoreCase(tmsId)) {
if (prev_timeEnded != 0) {
tune_duration = prev_timeEnded - prev_timeStarted;
output = setOutput(output, prev_acc_id, prev_rec_id, prev_tuner, prev_channel,
prev_show_name, prev_tmsId, prev_viewing_type, prev_event_type, prev_channelFamily,
prev_ruid, prev_suid, prev_timeStarted, prev_timeEnded, prev_datecreated, 0, 0,
tune_duration, manual_ffx, manual_ffr);
ae.outputResult(output);
prev_timeEnded = prev_timeStarted = 0;
setPreviousValues();
tune_duration = 0;
manual_ffr = 0;
manual_ffx = 0;
}
}
if (timeEnded != 0)
prev_timeEnded = timeEnded;
}
// ************ for DVR events
else if (prev_viewing_type.contains("DvrEvent")) {
if (tmsId != null)
if (!prev_tmsId.equalsIgnoreCase(tmsId)) {
if (!prev_event_type.equalsIgnoreCase("DVR_EOE")) {
output = setOutput(output, prev_acc_id, prev_rec_id, prev_tuner, prev_channel,
prev_show_name, prev_tmsId, prev_viewing_type, prev_event_type, prev_channelFamily,
prev_ruid, prev_suid, prev_timeStarted, prev_timeEnded, prev_datecreated,
prev_content_start, prev_content_end, dvr_time_watched, manual_ffx, manual_ffr);
ae.outputResult(output);
}
dvr_time_watched = 0;
manual_ffr = 0;
manual_ffx = 0;
setPreviousValues();
}
if (event_type != null && content_start != 0 && content_end != 0) {
// ******* total play time
if (event_type.equalsIgnoreCase("DVR_PLAY") || event_type.equalsIgnoreCase("DVR_PAUSE")) {
dvr_time_watched += (content_end - content_start);
// play_end = row.getCONTENT_END_EPOCH();
}
// ********* total ffx time
if (event_type.contains("FWD_START") && !event_type.contains("SKIP")) {
manual_ffx += (content_end - content_start);
}
// ********** total ffr time
if (event_type.contains("FWD_END") && !event_type.contains("SKIP")) {
manual_ffr += (content_end - content_start);
}
}
}
// ************ for Vod events
else if (prev_viewing_type.equalsIgnoreCase("VODEvent")) {
if (ruid != null)
if (!prev_ruid.equalsIgnoreCase(ruid)) {
if (!prev_event_type.equalsIgnoreCase("DVR_EOE")) {
output = setOutput(output, prev_acc_id, prev_rec_id, prev_tuner, prev_channel,
prev_show_name, prev_tmsId, prev_viewing_type, prev_event_type, prev_channelFamily,
prev_ruid, prev_suid, prev_timeStarted, prev_timeEnded, prev_datecreated,
prev_content_start, prev_content_end, vod_time_watched, manual_ffx, manual_ffr);
ae.outputResult(output);
}
vod_time_watched = 0;
manual_ffr = 0;
manual_ffx = 0;
setPreviousValues();
}
if (event_type != null && content_start != 0 && content_end != 0) {
// ******* total play time
if (event_type.equalsIgnoreCase("DVR_PLAY") || event_type.equalsIgnoreCase("DVR_PAUSE")) {
vod_time_watched += (content_end - content_start);
// play_end = row.getCONTENT_END_EPOCH();
}
// ********* total ffx time
if (event_type.contains("FWD_START") && !event_type.contains("SKIP")) {
manual_ffx += (content_end - content_start);
}
// ********** total ffr time
if (event_type.contains("FWD_END") && !event_type.contains("SKIP")) {
manual_ffr += (content_end - content_start);
}
}
}
}
return 0;
}
/**
*
*/
private static void setPreviousValues() {
prev_acc_id = acc_id;
prev_rec_id = rec_id;
prev_tuner = tuner;
prev_channel = channel;
prev_show_name = show_name;
prev_tmsId = tmsId;
prev_viewing_type = viewing_type;
prev_event_type = event_type;
prev_channelFamily = channelFamily;
prev_ruid = ruid;
prev_suid = suid;
prev_timeStarted = timeStarted;
prev_timeEnded = timeEnded;
prev_datecreated = datecreated;
prev_content_start = content_start;
prev_content_end = content_end;
}
/**
* @param output
* @param accId
* @param recId
* @param string
* @param channel
* @param showName
* @param tmsId
* @param eventName
* @param eventType
* @param channelFamily
* @param ruid
* @param suid
* @param timeStarted
* @param timeEnded
* @param fieldAsTimestamp2
* @param contentStart
* @param contentEnd
* @param duration
* @param manualFfx
* @param manualFfr
*/
private static NzaeRecord setOutput(NzaeRecord output, String accId, String recId, String string, String channel,
String showName, String tmsId, String eventName, String eventType, String channelFamily, String ruid,
int suid, double timeStarted, double timeEnded, Timestamp fieldAsTimestamp2, double contentStart,
double contentEnd, double duration, double manualFfx, double manualFfr) {
output.setField(0, accId);
output.setField(1, recId);
output.setField(2, string);
output.setField(3, channel);
output.setField(4, showName);
output.setField(5, tmsId);
output.setField(6, eventName);
output.setField(7, eventType);
output.setField(8, channelFamily);
output.setField(9, ruid);
output.setField(10, suid == 0 ? null : suid);
output.setField(11, timeStarted == 0 ? null : timeStarted);
output.setField(12, timeEnded == 0 ? null : timeEnded);
output.setField(13, fieldAsTimestamp2);
output.setField(14, contentStart == 0 ? null : contentStart);
output.setField(15, contentEnd == 0 ? null : contentEnd);
output.setField(16, duration);
output.setField(17, manualFfx);
output.setField(18, manualFfr);
return output;
}
/**
* @param meta
*/
private static void validateInput(NzaeMetadata meta) {
if (meta.getOutputColumnCount() != 19) {
throw new NzaeException("expecting 19 output columns ");
}
if (meta.getInputColumnCount() != 16) {
throw new NzaeException("expecting 16 input columns");
}
if (meta.getInputNzType(0) != NzaeDataTypes.NZUDSUDX_FIXED
&& meta.getInputNzType(0) != NzaeDataTypes.NZUDSUDX_VARIABLE) {
throw new NzaeException("first input column (Account id hashed) expected to be a string type");
}
if (meta.getInputNzType(1) != NzaeDataTypes.NZUDSUDX_FIXED
&& meta.getInputNzType(1) != NzaeDataTypes.NZUDSUDX_VARIABLE) {
throw new NzaeException("second input column (Receiver id hashed) expected to be a string type");
}
if (meta.getInputNzType(2) != NzaeDataTypes.NZUDSUDX_FIXED
&& meta.getInputNzType(2) != NzaeDataTypes.NZUDSUDX_VARIABLE) {
throw new NzaeException("third input column (Tuner) expected to be a string type");
}
if (meta.getInputNzType(3) != NzaeDataTypes.NZUDSUDX_FIXED
&& meta.getInputNzType(3) != NzaeDataTypes.NZUDSUDX_VARIABLE) {
throw new NzaeException("fourth input column (Channel) expected to be a string type");
}
if (meta.getInputNzType(4) != NzaeDataTypes.NZUDSUDX_NATIONAL_FIXED
&& meta.getInputNzType(4) != NzaeDataTypes.NZUDSUDX_NATIONAL_VARIABLE) {
throw new NzaeException("fifth input column (Show name) expected to be a string type");
}
if (meta.getInputNzType(5) != NzaeDataTypes.NZUDSUDX_FIXED
&& meta.getInputNzType(5) != NzaeDataTypes.NZUDSUDX_VARIABLE) {
throw new NzaeException("sixth input column (TMS_ID) expected to be a string type");
}
if (meta.getInputNzType(6) != NzaeDataTypes.NZUDSUDX_FIXED
&& meta.getInputNzType(6) != NzaeDataTypes.NZUDSUDX_VARIABLE) {
throw new NzaeException("seventh input column (Event Name) expected to be a string type");
}
if (meta.getInputNzType(7) != NzaeDataTypes.NZUDSUDX_FIXED
&& meta.getInputNzType(7) != NzaeDataTypes.NZUDSUDX_VARIABLE) {
throw new NzaeException("eighth input column (Event type) expected to be a string type");
}
if (meta.getInputNzType(8) != NzaeDataTypes.NZUDSUDX_FIXED
&& meta.getInputNzType(8) != NzaeDataTypes.NZUDSUDX_VARIABLE) {
throw new NzaeException("nineth input column (CHANNEL_FAMILY) expected to be a string type");
}
if (meta.getInputNzType(9) != NzaeDataTypes.NZUDSUDX_FIXED
&& meta.getInputNzType(9) != NzaeDataTypes.NZUDSUDX_VARIABLE) {
throw new NzaeException("thenth input column (RUID) expected to be a string type");
}
if (meta.getInputNzType(10) != NzaeDataTypes.NZUDSUDX_FIXED
&& meta.getInputNzType(10) != NzaeDataTypes.NZUDSUDX_INT32) {
throw new NzaeException("eleventh input column (SUID) expected to be a integer type");
}
if (meta.getInputNzType(11) != NzaeDataTypes.NZUDSUDX_FIXED
&& meta.getInputNzType(11) != NzaeDataTypes.NZUDSUDX_INT64) {
throw new NzaeException("twelfth input column (Start Epoch) expected to be a Big Integer type");
}
if (meta.getInputNzType(12) != NzaeDataTypes.NZUDSUDX_FIXED
&& meta.getInputNzType(12) != NzaeDataTypes.NZUDSUDX_INT64) {
throw new NzaeException("thirteenth input column (End Epoch) expected to be a Big Integer type");
}
if (meta.getInputNzType(13) != NzaeDataTypes.NZUDSUDX_FIXED
&& meta.getInputNzType(13) != NzaeDataTypes.NZUDSUDX_TIMESTAMP) {
throw new NzaeException("fourteenth input column (Date created) expected to be a timestamp type");
}
if (meta.getInputNzType(14) != NzaeDataTypes.NZUDSUDX_FIXED
&& meta.getInputNzType(14) != NzaeDataTypes.NZUDSUDX_INT64) {
throw new NzaeException("fifteenth input column (Content start date) expected to be a Big Integer type");
}
if (meta.getInputNzType(15) != NzaeDataTypes.NZUDSUDX_FIXED
&& meta.getInputNzType(15) != NzaeDataTypes.NZUDSUDX_INT64) {
throw new NzaeException("sixteenth input column (Content end date) expected to be a big Integer type");
}
}
}
关于java - Netezza Java UDTF 自定义函数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15707799/
C语言sscanf()函数:从字符串中读取指定格式的数据 头文件: ?
最近,我有一个关于工作预评估的问题,即使查询了每个功能的工作原理,我也不知道如何解决。这是一个伪代码。 下面是一个名为foo()的函数,该函数将被传递一个值并返回一个值。如果将以下值传递给foo函数,
CStr 函数 返回表达式,该表达式已被转换为 String 子类型的 Variant。 CStr(expression) expression 参数是任意有效的表达式。 说明 通常,可以
CSng 函数 返回表达式,该表达式已被转换为 Single 子类型的 Variant。 CSng(expression) expression 参数是任意有效的表达式。 说明 通常,可
CreateObject 函数 创建并返回对 Automation 对象的引用。 CreateObject(servername.typename [, location]) 参数 serv
Cos 函数 返回某个角的余弦值。 Cos(number) number 参数可以是任何将某个角表示为弧度的有效数值表达式。 说明 Cos 函数取某个角并返回直角三角形两边的比值。此比值是
CLng 函数 返回表达式,此表达式已被转换为 Long 子类型的 Variant。 CLng(expression) expression 参数是任意有效的表达式。 说明 通常,您可以使
CInt 函数 返回表达式,此表达式已被转换为 Integer 子类型的 Variant。 CInt(expression) expression 参数是任意有效的表达式。 说明 通常,可
Chr 函数 返回与指定的 ANSI 字符代码相对应的字符。 Chr(charcode) charcode 参数是可以标识字符的数字。 说明 从 0 到 31 的数字表示标准的不可打印的
CDbl 函数 返回表达式,此表达式已被转换为 Double 子类型的 Variant。 CDbl(expression) expression 参数是任意有效的表达式。 说明 通常,您可
CDate 函数 返回表达式,此表达式已被转换为 Date 子类型的 Variant。 CDate(date) date 参数是任意有效的日期表达式。 说明 IsDate 函数用于判断 d
CCur 函数 返回表达式,此表达式已被转换为 Currency 子类型的 Variant。 CCur(expression) expression 参数是任意有效的表达式。 说明 通常,
CByte 函数 返回表达式,此表达式已被转换为 Byte 子类型的 Variant。 CByte(expression) expression 参数是任意有效的表达式。 说明 通常,可以
CBool 函数 返回表达式,此表达式已转换为 Boolean 子类型的 Variant。 CBool(expression) expression 是任意有效的表达式。 说明 如果 ex
Atn 函数 返回数值的反正切值。 Atn(number) number 参数可以是任意有效的数值表达式。 说明 Atn 函数计算直角三角形两个边的比值 (number) 并返回对应角的弧
Asc 函数 返回与字符串的第一个字母对应的 ANSI 字符代码。 Asc(string) string 参数是任意有效的字符串表达式。如果 string 参数未包含字符,则将发生运行时错误。
Array 函数 返回包含数组的 Variant。 Array(arglist) arglist 参数是赋给包含在 Variant 中的数组元素的值的列表(用逗号分隔)。如果没有指定此参数,则
Abs 函数 返回数字的绝对值。 Abs(number) number 参数可以是任意有效的数值表达式。如果 number 包含 Null,则返回 Null;如果是未初始化变量,则返回 0。
FormatPercent 函数 返回表达式,此表达式已被格式化为尾随有 % 符号的百分比(乘以 100 )。 FormatPercent(expression[,NumDigitsAfterD
FormatNumber 函数 返回表达式,此表达式已被格式化为数值。 FormatNumber( expression [,NumDigitsAfterDecimal [,Inc
我是一名优秀的程序员,十分优秀!