嗨,不久前我的一所大学,通过将电子邮件地址组合在一起,根据二进制值是否作为输入处于活动状态,为电子邮件地址制作了这个脚本。
我想稍微改变一下,以便邮件地址根据二进制值输出到不同的输出。这就是问题所在:我有很多看护人,他们有很多建筑物,他们一直在跟踪。他们需要在不同的时间接收邮件(IE X 数量的人首先收到,然后其他 3 人在 15 分钟后收到邮件。等等。)我决定在每个建筑物中设置 4 个类别。他们决定他们想要的构建和类别。我从他们的选择中生成一个二进制值(数字)。
我想使用那个二进制值。将他们的邮件地址发送到不同的输出,将它们完全组合在一起,用于邮件中的 TO:字段。
如果有任何帮助,我将此代码用于 Niagara Ax 中的程序块
这是我拼贴回来的代码,我想从真/假输入更改为二进制输入。其中二进制值(位)对应于输出。但我很难弄清楚。
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
}