我正在尝试在数据库中找到相同的登录ID用户。
首先我将每个用户都列入跳过列表,然后我想逐个进行比较。我的问题是如何才能获得跳过清单上的关键值。
我的代码片段在这里:
for lUser in userList do {
string uName = lUser.name
string uEmail = lUser.email
string uSys = lUser.systemLoginName
string uAdr = lUser.address
outBuf += uName sep uSys sep uEmail sep uAdr
outBuf += "\n"
// Here I have to add some code, I can put the values but not get again or compare
// I need some for loop and get every key value
put(skiplist,count,uSys)
print count
print "\n"
count++
}
有人可以提供这方面的建议,我是这种语言的新手。提前谢谢。
编辑:现在正在运作
pragma runLim,0
string sep = ";"
string dbName = getDatabaseName
print "\n" "List of doors user in database " getDatabaseName ": \n\n"
int count = 0
User lUser
Group lGroup
Skip skiplist = create
for lUser in userList do {
string uName = lUser.name
string uEmail = lUser.email
string uSys = lUser.systemLoginName
string uAdr = lUser.address
if(null uSys)
{
print uName " doesn't have a System Name.\n"
} else {
bool flagDuplicate = false
string nameDuplicate = ""
string s = ""
for s in skiplist do {
if(s == uSys) {
flagDuplicate = true
nameDuplicate = (string key skiplist)
break
}
}
if(flagDuplicate) print "Users '" uName "' and '" nameDuplicate "' have the same System Name (" uSys ").\n"
else put(skiplist,uName,uSys)
}
}
pragma runLim,0
此行用于避免执行时间警告。
答案 0 :(得分:1)
听起来你正在寻找的是:
for lUser in userList do {
string uName = lUser.name
string uEmail = lUser.email
string uSys = lUser.systemLoginName
string uAdr = lUser.address
outBuf += uName sep uSys sep uEmail sep uAdr
outBuf += "\n"
if(null uSys)
{
print uName " doesn't have a System Name.\n"
} else {
bool flagDuplicate = false
string nameDuplicate = ""
string s = ""
for s in skiplist do {
if(s == uSys) {
flagDuplicate = true
nameDuplicate = (string key skiplist)
break
}
}
if(flagDuplicate) print "Users '" uName "' and '" nameDuplicate "' have the same System Name (" uSys ")."
else put(skiplist,uName,uSys)
print "\n"
}
}
编辑:我添加了空白uSys
的检查,你可以在那里做任何你想做的事情,如果你只想将所有空的那些添加到一个列表中,然后在最后也将它打印出来。
这至少应该指向正确的方向。
注意:我目前无法测试此代码,所以如果有任何错误或拼写错误我会道歉。但我认为这会让你足够接近。
祝你好运!