Click HERE to see how Saviynt Intelligence is transforming the industry. |
08/13/2024 09:40 PM
Hi Team,
We are trying to populate manager attribute based on the customdate. If the customdate is future dated it must retain the old manager value which is CU.MANAGER. However, when we perform a csv import through schema import via SAV File, it is blanking out the manager attribute.
Query: UPDATE NEWUSERDATA NU
LEFT JOIN CURRENTUSERS CU ON NU.USERNAME = CU.USERNAME
LEFT JOIN (
SELECT USERNAME, STR_TO_DATE(CUSTOMPROPERTY13, '%m-%d-%Y') AS CustomDate
FROM NEWUSERDATA
) AS DV ON NU.USERNAME = DV.USERNAME
SET
NU.MANAGER = CASE
WHEN DV.CustomDate IS NOT NULL AND DV.CustomDate = CURDATE() THEN NU.MANAGER
WHEN DV.CustomDate < CURDATE() THEN NU.MANAGER
ELSE CU.MANAGER (failing condition)
END
Please assist on this.
Thank you.
Regards,
Aarthi Anand
08/13/2024 09:41 PM
UPDATE NEWUSERDATA NU
LEFT JOIN CURRENTUSERS CU ON NU.USERNAME = CU.USERNAME
LEFT JOIN (
SELECT USERNAME, STR_TO_DATE(CUSTOMPROPERTY13, '%m-%d-%Y') AS CustomDate
FROM NEWUSERDATA
) AS DV ON NU.USERNAME = DV.USERNAME
SET NU.MANAGER = CASE
WHEN DV.CustomDate IS NULL THEN NU.MANAGER
WHEN DV.CustomDate = CURDATE() THEN NU.MANAGER
WHEN DV.CustomDate < CURDATE() THEN NU.MANAGER
ELSE CU.MANAGER
END;
08/13/2024 09:53 PM
Hi @rushikeshvartak,
I have tried this as well. However, the manager attribute is getting blanked out again. If it is NU.MANAGER then it is taking from the CSV during import. But if we mention CU.MANAGER it is blanking out. Attached the SAV File for you reference.
Regards,
Aarthi Anand
08/13/2024 09:58 PM
Hi @aarthianand93 , try setting owner instead of manager once.
UPDATE NEWUSERDATA NU
LEFT JOIN CURRENTUSERS CU ON NU.USERNAME = CU.USERNAME
LEFT JOIN (
SELECT USERNAME, STR_TO_DATE(CUSTOMPROPERTY13, '%m-%d-%Y') AS CustomDate
FROM NEWUSERDATA
) AS DV ON NU.USERNAME = DV.USERNAME
SET NU.owner = CASE
WHEN DV.CustomDate IS NULL THEN NU.owner
WHEN DV.CustomDate = CURDATE() THEN NU.owner
WHEN DV.CustomDate < CURDATE() THEN NU.owner
ELSE CU.owner
END;
08/13/2024 10:09 PM
Hi @NM,
Thank you very much. This usecase is working. However, we are refraining from using owner. Is there any reason why this is not working for manager? Can we accommodate manager attribute here by making any other changes? Please let me know.
Regards,
Aarthi Anand
08/13/2024 10:12 PM
Hi @NM,
I just tested this out it is working for future date but past date is failing. So it has to work for past date, current date and future date in customdate attribute. Please check the SAV File I have provided for reference. Please let us know how this can be resolved. Thank you.
Regards,
Aarthi Anand
08/13/2024 10:19 PM - edited 08/13/2024 10:21 PM
Hi @aarthianand93 , what error do you see for past date??
Does it not update?
08/13/2024 10:26 PM
Hi @NM,
It is making the existing manager value as blank when past date is imported in csv.
expected result:
if it is past date/currentdate in customdate it must make the manager value as new manager from CSV,
if it is future date in customdate it must retain existing manager value and no change must be made.
Regards,
Aarthi
08/13/2024 10:44 PM
UPDATE NEWUSERDATA NU
LEFT JOIN CURRENTUSERS CU ON NU.USERNAME = CU.USERNAME
LEFT JOIN (
SELECT USERNAME, STR_TO_DATE(CUSTOMPROPERTY13, '%m-%d-%Y') AS CustomDate
FROM NEWUSERDATA
) AS DV ON NU.USERNAME = DV.USERNAME
SET NU.owner = CASE
WHEN DV.CustomDate IS NULL THEN NU.owner
WHEN DV.CustomDate <= CURDATE() THEN CU.owner
ELSE NU.owner
END;
08/13/2024 10:54 PM
Hi @rushikeshvartak,
I tried this above query. Again the manager is blanked out.
Regards,
Aarthi Anand
08/13/2024 10:30 PM - edited 08/13/2024 10:30 PM
UPDATE NEWUSERDATA NU
LEFT JOIN CURRENTUSERS CU ON NU.USERNAME = CU.USERNAME
LEFT JOIN (
SELECT USERNAME, STR_TO_DATE(CUSTOMPROPERTY13, '%m-%d-%Y') AS CustomDate
FROM NEWUSERDATA
) AS DV ON NU.USERNAME = DV.USERNAME
SET NU.owner = CASE
WHEN DV.CustomDate IS NULL THEN (select nu1.username from NEWUSERDATA NU1 WHERE nu.manager=NU1.id )
ELSE CU.owner
END;
08/13/2024 10:31 PM
@aarthianand93 can you just try the above query and provide me with the observation.
08/13/2024 10:48 PM
Hi @NM,
It is giving an error for the NU1.id in the WHERE clause.
Thank you.
Note: We have many queries in the SAV File for different attributes like title, departmentname, companyname etc. And for all other attributes the usecases are working correctly, except the manager attribute.
Regards,
Aarthi Anand
08/13/2024 10:51 PM - edited 08/13/2024 10:58 PM
@aarthianand93 try
UPDATE NEWUSERDATA NU
LEFT JOIN CURRENTUSERS CU ON NU.USERNAME = CU.USERNAME
LEFT JOIN (
SELECT USERNAME, STR_TO_DATE(CUSTOMPROPERTY13, '%m-%d-%Y') AS CustomDate
FROM NEWUSERDATA
) AS DV ON NU.USERNAME = DV.USERNAME
SET NU.owner = CASE
WHEN DV.CustomDate IS NULL THEN (select CU1.username from CURRENTUSERS CU1 WHERE nu.manager=CU1.id )
ELSE CU.owner
END;
08/13/2024 10:59 PM
08/13/2024 11:01 PM
I updated the previous query try that. @aarthianand93
08/13/2024 11:07 PM
08/13/2024 11:17 PM - edited 08/13/2024 11:17 PM
@aarthianand93 instead of id try userkey ..
we are trying to get username of the new manager
and also, in computed column add userkey so it gets pulled into the query
08/13/2024 11:31 PM
Hi @NM,
For your query, if we pass manager value with custom date as past date, current date, or future date all the updates are flowing through, which shouldn't happen.
08/13/2024 11:33 PM
@aarthianand93 , yes because i remove some of the condition to check if it is working fine.
if it works .. we can add your original condition and just have the query in then.
08/14/2024 12:35 AM
Hi @rushikeshvartak @NM,
Please let us know if there is any way we can change the query for manager attribute instead of owner for future date. We have to know if this is feasible to respond to client. Thank you.
Regards,
Aarthi Anand
08/14/2024 02:43 AM
Hi Team,
I see one other person faced same issue as mentioned in the forum post: https://forums.saviynt.com/t5/identity-governance/preprocessor-in-sav-file-manager-value-disappearin...
However, it is unresolved. I also tried those queries but still manager attribute is blanked out.
Please keep me posted if you find any fix for this. Thank you.
Regards,
Aarthi Anand
08/14/2024 02:44 AM
@aarthianand93 is it working when you use owner field??
08/14/2024 02:53 AM
Hi @NM,
I just validated again but is not working it is blanking out the manager attribute.
Regards,
Aarthi Anand
08/14/2024 02:55 AM
@aarthianand93 share updated value which you used recently.
08/14/2024 03:00 AM
08/14/2024 05:17 AM
Can you share logs
08/14/2024 05:28 AM - last edited on 08/18/2024 10:07 PM by Sunil
Attached are the logs for your reference.
[This message has been edited by moderator to mask sensitive information]
08/14/2024 05:31 AM
There is SQL error. Not sure if its related to current issue.
08/14/2024 05:38 AM
Hi @rushikeshvartak,
We have tested same query for multiple attributes, every other attribute is working, except manager. I validated the SQL query many times. In the other forum post linked here as well they have used a similar query. Please help on the error so we can mitigate it.
Thank you.
Regards,
Aarthi Anand
08/14/2024 05:47 AM
Convert Update query to select query and validate from data analyzer
08/14/2024 06:20 AM
If we validate the SQL, it is found valid, but data analyzer is saying there is a syntax error.
I made significant changes to the query to mitigate the error but it still persists. Please suggest how we change this query. Attached screenshots of the error.
08/14/2024 06:23 AM
@aarthianand93 data analyzer doesn't support update query change it to select query.
08/14/2024 06:25 AM
@NM,
If I give UPDATE it is giving ERROR: operation not allowed. So, I have given SELECT statement only.
08/14/2024 06:36 AM
08/14/2024 06:41 AM
08/14/2024 06:51 AM
It will be users table and not currentusers/ new users
08/14/2024 07:03 AM
I executed with USERS Table but still the error persists. Please let me know if there is any other changes I can make. If it is a product limitation please clarify on that as well. Screenshot attached.
08/14/2024 07:05 AM
NEWUSERS data is still there in query
08/14/2024 07:09 AM - edited 08/14/2024 07:13 AM
Hi @rushikeshvartak,
UPDATE NEWUSERDATA NU LEFT JOIN CURRENTUSERS - please let me know which should be updated to USERS.
Also, we are using UPDATE NEWUSERDATA for other queries as well. And they are working fine. Below department query works fine when using NEWUSERDATA table.
Why this manager query is failing specifically? Please let us know.
Department Query:
NU.DEPARTMENTNAME=CASE WHEN DV.CustomDate IS NOT NULL AND DV.CustomDate=CURDATE() THEN NU.DEPARTMENTNAME WHEN DV.CustomDate<CURDATE() THEN NU.DEPARTMENTNAME ELSE CU.DEPARTMENTNAME END
08/18/2024 08:41 PM
Hi Team,
We found this query to be a working one where the manager attribute is not wiped out.
UPDATE NEWUSERDATA NU LEFT JOIN CURRENTUSERS CU ON NU.USERNAME=CU.USERNAME LEFT JOIN (SELECT USERNAME, STR_TO_DATE(CUSTOMPROPERTY13, '%m-%d-%Y') AS CustomDate FROM NEWUSERDATA) AS DV ON NU.USERNAME=DV.USERNAME SET NU.MANAGER=CASE WHEN DV.CustomDate IS NOT NULL AND DV.CustomDate=CURDATE() THEN NU.MANAGER WHEN DV.CustomDate<CURDATE() THEN NU.MANAGER WHEN DV.CustomDate>CURDATE() THEN CU.OWNER END
Thank you.
Regards,
Aarthi Anand