Javascript 如何基于二进制值编写文本输出脚本
您好,我的一所大学,通过将电子邮件地址组合在一起(如果二进制值作为输入是活动的),为电子邮件地址制作了这个脚本 我想稍微改变一下,这样mailaddress就可以根据二进制值输出到不同的输出。 问题是: 我有很多看门人,他们有很多建筑,他们一直在跟踪。他们需要在不同的时间接收邮件(即X数量的人先收到邮件,然后其他3人15分钟后收到邮件,等等) 我决定在每栋建筑中分为4类。他们决定他们想要的构建和类别。我从他们的选择中生成一个二进制值(数字) 我想用那个二进制值。在不同的输出上发送他们的邮件地址,将它们组合在一起,用于邮件中的To:字段 如果有任何帮助,我会用这段代码在尼亚加拉Ax中创建一个程序块 这是我拼贴的代码,我想从真/假输入改为二进制输入。 其中二进制值(位)对应于输出。但我很难弄明白Javascript 如何基于二进制值编写文本输出脚本,javascript,java,niagara-ax,Javascript,Java,Niagara Ax,您好,我的一所大学,通过将电子邮件地址组合在一起(如果二进制值作为输入是活动的),为电子邮件地址制作了这个脚本 我想稍微改变一下,这样mailaddress就可以根据二进制值输出到不同的输出。 问题是: 我有很多看门人,他们有很多建筑,他们一直在跟踪。他们需要在不同的时间接收邮件(即X数量的人先收到邮件,然后其他3人15分钟后收到邮件,等等) 我决定在每栋建筑中分为4类。他们决定他们想要的构建和类别。我从他们的选择中生成一个二进制值(数字) 我想用那个二进制值。在不同的输出上发送他们的邮件地址,
public void onStart() throws Exception
{
// start up code here
}
public void onExecute() throws Exception
{
// execute code (set executeOnChange flag on inputs)
String emailRecipients = "";
int n = 0;
if (getEnable_A1().getValue() == true)
{
emailRecipients+=getMailAddress_1().getValue();
emailRecipients+=';';
n++;
}
if (getEnable_A2().getValue() == true)
{
emailRecipients+=getMailAddress_2().getValue();
emailRecipients+=';';
n++;
}
if (getEnable_A3().getValue() == true)
{
emailRecipients+=getMailAddress_3().getValue();
emailRecipients+=';';
n++;
}
if (getEnable_A4().getValue() == true)
{
emailRecipients+=getMailAddress_4().getValue();
emailRecipients+=';';
n++;
}
if (getEnable_A5().getValue() == true)
{
emailRecipients+=getMailAddress_5().getValue();
emailRecipients+=';';
n++;
}
if (getEnable_A6().getValue() == true)
{
emailRecipients+=getMailAddress_6().getValue();
emailRecipients+=';';
n++;
}
if (getEnable_A7().getValue() == true)
{
emailRecipients+=getMailAddress_7().getValue();
emailRecipients+=';';
n++;
}
if (getEnable_A8().getValue() == true)
{
emailRecipients+=getMailAddress_8().getValue();
emailRecipients+=';';
n++;
}
if (getEnable_A9().getValue() == true)
{
emailRecipients+=getMailAddress_9().getValue();
emailRecipients+=';';
n++;
}
if (getEnable_A10().getValue() == true)
{
emailRecipients+=getMailAddress_10().getValue();
emailRecipients+=';';
n++;
}
if (n>0) // one or more enabled ...
{
// strip trailing ';' ...
int l = emailRecipients.length();
if (emailRecipients.substring(l-1, l).equals(";"))
{
emailRecipients = emailRecipients.substring(0, l-1);
}
}
else if (n == 0) // No mail recipients enabled ...
{
emailRecipients = "";
}
setAddressListOut(BEmailAddressList.make(emailRecipients));
// "debug"
getRecipients().setValue(emailRecipients);
getN_Recipients().setValue(n);
}
public void onStop() throws Exception
{
// shutdown code here
}