on 07-20-2016 6:43 PM
Hello everyone,
So I have a fun one... As part of my current project, I need to write a query to check if a particular attribute is not assigned. Not NULL, but not a part of the IDM entry (as in an attribute that was once populated and was removed via {D})
So in essence, I want to see all entries (MX_PERSON to be exact) that do not have a given attribute(s). In my case it's MX_FIRSTNAME, MX_LASTNAME, and DISPLAYNAME. We have a process that's blanking those out, causing some issues so we need to go find and fix them.
If someone has a better way of considering this problem, I'm open to that too!
I'm running this project on Oracle, but if you come up with something in MS SQL, hopefully I can work with it.
Thanks for your help!
Cheers,
Matt
Hello Matt,
in reports or statements to find entries to fix, I use stuff like
select * from idmv_entry_simple wheremcmskey is NOT in (select mskey from idmv_value_basic where attrname = 'MX_LASTNAME')
a lot.
I had a similar task as you now (finding identities with windows accounts, where those 3 attributes were not filled) and so I just created a SQL statement that resulted in all identities, where one of those attributes was not filled (using the statement above with OR to also check the other two).
Regards,
Steffi.
PS: I'm on Oracle, as you know. ^^
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Matt,
Seems like you have already got what you want, but anyway, this is my way:
select mcMSKEYVALUE from idmv_entry_simple with (nolock) where mcEntryType = 'MX_PERSON'
and mcMSKEY not in (select mskey from idmv_value_basic with (nolock) where attrname = 'DISPLAYNAME')
union
select mcMSKEYVALUE from idmv_entry_simple with (nolock) where mcEntryType = 'MX_PERSON'
and mcMSKEY not in (select mskey from idmv_value_basic with (nolock) where attrname = 'MX_FIRSTNAME')
union
select mcMSKEYVALUE from idmv_entry_simple with (nolock) where mcEntryType = 'MX_PERSON'
and mcMSKEY not in (select mskey from idmv_value_basic with (nolock) where attrname = 'MX_LASTNAME')
This will give a distinct list of all persons missing one or more of the attributes.
Regards,
Ole K.
Hi Matt,
Sure you can get the MSKEY. It would be select mcMSKEY, mcMSKEYVALUE from idmv_entry_simple ....
Also if you have several IdStores and want this check to be valid for only one of them, you have to add the IdStor to the queries.
select mcMSKEY, mcMSKEYVALUE from idmv_entry_simple with (nolock) where mcEntryType = 'MX_PERSON' and mcIdStore = 1
and mcMSKEY not in (select mskey from idmv_VALUE_BASIC where attrname = 'DISPLAYNAME' and IS_ID = 1)
union
select mcMSKEY, mcMSKEYVALUE from idmv_entry_simple with (nolock) where mcEntryType = 'MX_PERSON' and mcIdStore = 1
and mcMSKEY not in (select mskey from idmv_VALUE_BASIC where attrname = 'MX_FIRSTNAME' and IS_ID = 1)
union
select mcMSKEY, mcMSKEYVALUE from idmv_entry_simple with (nolock) where mcEntryType = 'MX_PERSON' and mcIdStore = 1
and mcMSKEY not in (select mskey from idmv_VALUE_BASIC where attrname = 'MX_LASTNAME' and IS_ID = 1)
Ole K.
The link and entry views are really neat though. If they wouldn't exist, I'd build them myself.
Actually we added a function for transposition of the most relevant attributes and a lot of views / procedures for our own request forms and our daily work.
The function got a bit slow when we went 35000+ identities, but in the redesign I got that covered.
Hi Matt,
depends where you need it. I'll use the value view and DISPLAYNAME in my examples.
In a conditinal task:
Select count(*) from idmv_value_ext where mskey = %mskey% and attrname = 'DISPLAYNAME'.
And placing whatever you need in the false part. But I guess that's not really what you want.
In a Source tab of a batch job, where you want to find all entries which don't have that attribute and using the Identity Store option:
select mcmskey mskey from idmv_entry_simple where mcEntryType = 'MX_PERSON' where not mcmskey in (select mskey from idmv_value_ext where attrname = 'DISPLAYNAME')
In a Source tab where you don't want to use the Identity Store option:
select * from (
select whatever you want, adding the displayname as column with a sub-select* in the select part
) allrows where displayname is null
No problems with performance on that outer select / correlated subquery
If you want to double check on the history view if the value was once present each query has to be joined with the mxiv_oentries (idmv_ovalue_basic_all) adding a "where o.attrname = 'DISPLAYNAME' with the history view named o and the value named v or something.
The queries should work for MSSQL (with (nolock) should be added though on all views) and Oracle. Yet, I am not entirly sure about the outer select / correlated subquery thingy.
Best regards
Dominik
*Example of what I mean with sub-select as I always keep on forgetting what the name for this is. The example has nothing to do with your question, I just copied that query out of my saved queries:
select
(select taskname from mxp_tasks with (nolock) where taskid = s.TaskId) taskName, s.*
from mxp_audit s with (nolock) where mskey = 12345
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
87 | |
10 | |
10 | |
9 | |
7 | |
6 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.