Publié Thu, 12 Jul 2018 10:16:01 GMT par Petar Georgiev

Hello,

I have the following situation: One of our clients wants to use the following restriction - while storing document (so it is in store dioalog), in the field Next instance, containing all users of DocuWare, the current user not to be able to choose himself. 

Example: If all users of the system are A, B, C, D, E, and user D is logged in, when he tries to store a document, and fill the field Next instance, to see only users A, B, C and E. 

I have an idea to use select list, with SQL Statement, looking like this: Select username from all_users Where username != currentuserlongname. The question is, how can I get the "currentuserlongname". Can someone tell me where the "currentuserlongname" is stored, and am I allowed to use it for select list like this. 

Also, if anyone has another idea, I'll be happy to hear(read) about it.

 

Thanks in advance!

Publié Fri, 13 Jul 2018 11:52:00 GMT par Josef Zayats

Petar,

#1.First, create a 2-column database table with the following entries (following your example above):A/B,A/C,A/D, A/E, B/A, B/C, B/D, B/E, C/A, C/B, C/D, C/E, D/A,D/B,D/C, D/E, E/A,E/B,E/C,E/D (in short, it has all possible pairs except of A/A, B/B, C/C etc)

Such table can be easily created programmatially from your user list, and if you are good with SQL, you can even do it as a view to your dwuser table (using only column name). For Docuware Cloud system this would have to be done as a table on a local database accessable via local database connector) 

#2 Create a 2-column Docuware Select list based on the table/view from #1

#3 Then, add an additional field to your DW FC and to your store dialog, and call it, let's say CurrentUser. In the store dialog make this field a prdefined entry = CURRENTUSERLONGNAME. If wanted, this field may be made 'hidden' in the store dialog.

#4. And, finally, make your payload field in your store dialog to be a select list only from the  2nd column of the #2 above while filtered on CurrentUser field from #3 being equal column1 from #2 select list.

Publié Fri, 13 Jul 2018 12:09:30 GMT par Petar Georgiev

Josef,

Thank You for the idea. Unfortunately it is my fault that I missed one parameter of the project, that is not allowing me to create such 2 column table - the client has 1000+ users. Most of them (more than 600) have the right to store this kind of documents. So the table will contain too many rows, and administrators will not like this - to add(remowe) more than 600 rows in a table when user is hired(fired). I know there is an option for automatic update, but still not sure if it will work fine. 

That is why I asked if I can use SQL statement.

Maybe I can think of some validation (if it is possible) - store user not to be equal to some of the values in field Next Instance (yeah, Next Instance is keyword field). I will have to try it this way. 

Thanks again for the idea!

 

Publié Fri, 13 Jul 2018 12:33:00 GMT par Josef Zayats

Petar,

I do not think you can use dwcurrentuserlongname variable in Select list SQl Command.

But here is a view generating statement I was talking about - no need to maintain. Create a view using this, and it'll be dynamic for new users.

select a.name AS Column1, b.name as Column2 from dwsystem.dbo.dwuser a, dwsystem.dbo.dwuser b where a.name<>b.name

Publié Mon, 16 Jul 2018 05:52:33 GMT par Petar Georgiev

Josef,

Thank You! I will try this in our client test enviroment and check how it works. I think it will be fine, just to check the speed. Thanks again. 

Best Regards,

Petar

You must be signed in to post in this forum.