Click HERE to see how Saviynt Intelligence is transforming the industry. |
05/29/2024 05:23 AM
I am trying to generate user name through preprocessor, the condition is like firstname.lastname, now if next user with the same first name and last name comes it should pick firstname.lastname1. Now I have given the iterations in the preprocessor. But if I upload 2 users with the same first name and last name through csv then first one is getting imported then if I upload the sheet again then only it is taking the next one, otherwise not. How to fix it?
Regards,
Indra
05/29/2024 06:03 AM
Hi @indra_hema_95 ,
Solution would be to also check the temp table (NEWUSERDATA) for uniqueness.
Below is the sample JSON: (Please use it as reference)
{
"ADDITIONALTABLES": {
"USERS" : "SELECT userkey,systemusername,username,firstname,lastname FROM USERS"
},
"COMPUTEDCOLUMNS" :[
"username",
],
"PREPROCESSQUERIES" : [
"UPDATE NEWUSERDATA set NEWUSERDATA.username=case
when (CONCAT(NEWUSERDATA.firstname,'.',NEWUSERDATA.lastname) in (select u.username from currentusers u)=0) AND (CONCAT(NEWUSERDATA.firstname,'.',NEWUSERDATA.lastname) in (select CONCAT(n.firstname,'.',n.lastname) from NEWUSERDATA n group by CONCAT(n.firstname,'.',n.lastname) having count(*)>1)=1) then CONCAT(NEWUSERDATA.firstname,'.',NEWUSERDATA.lastname)
when (CONCAT(NEWUSERDATA.firstname,'.',NEWUSERDATA.lastname,'1') in (select u.username from currentusers u)=0) AND (CONCAT(NEWUSERDATA.firstname,'.',NEWUSERDATA.lastname,'1') in (select CONCAT(n.firstname,'.',n.lastname,'1') from NEWUSERDATA n group by CONCAT(n.firstname,'.',n.lastname,'1') having count(*)>1)=0) then CONCAT(NEWUSERDATA.firstname,'.',NEWUSERDATA.lastname)
when (CONCAT(NEWUSERDATA.firstname,'.',NEWUSERDATA.lastname,'2') in (select u.username from currentusers u)=0) AND (CONCAT(NEWUSERDATA.firstname,'.',NEWUSERDATA.lastname,'2') in (select CONCAT(n.firstname,'.',n.lastname,'2') from NEWUSERDATA n group by CONCAT(n.firstname,'.',n.lastname,'2') having count(*)>1)=0) then CONCAT(NEWUSERDATA.firstname,'.',NEWUSERDATA.lastname)
ELSE CONCAT(NEWUSERDATA.firstname,'.',NEWUSERDATA.lastname,'3') END"
]
}
If this helps your question, please consider select Accept As Solution and hit Kudos
05/29/2024 02:06 PM
Hi @PremMahadikar getting below error.