在下面的代码块中,我有一个描述如下的标签:
"Today is your birthday %1! Company x wishes that all your dreams come true!"
下一段代码:
public void init()
{
UserId curUser = curUserId();
SysCompanyUserInfo sysCompanyUserInfo;
VendAccount emplName = SysCompanyUserInfo.VendAccount;
super();
if (curUser == SysCompanyUserInfo.UserId)
{
GreetingMessage.text(strfmt("@NET4183", emplName));
pause;
}
}
问题是emplName不会在标签本身内更新。 知道为什么吗? 谢谢!
答案 0 :(得分:3)
我认为问题出在sysCompanyUserInfo
,你永远不会为这张表选择一条记录。
你需要这个(或其他select * from sysCompanyUserInfo where...
):
SysCompanyUserInfo sysCompanyUserInfo = SysCompanyUserInfo::find(curUserId());
试试这个:
public void init(){
UserId curUser = curUserId();
SysCompanyUserInfo sysCompanyUserInfo = SysCompanyUserInfo::find(curUserId());
VendAccount emplName = SysCompanyUserInfo.VendAccount;
super();
if(curUser == SysCompanyUserInfo.UserId){
GreetingMessage.text(strfmt("@NET4183", emplName));
pause;
}
}