Sou novo no mundo de outystems e estou a desenvolver uma aplicação para sincronização de utilizadores com recurso a uma query LDAP, sendo que para tal estou a usar o LDAP Connector disponível na forge (https://www.outsystems.com/forge/component-overview/10490/ldap-connector-o11).
Pelo facto de trabalhar numa empresa com uma estrutura orgânica complexa, preciso de obter um total de 280 atributos, por cada utilizador, como resultado da minha query, sendo que posteriormente utilizo os atributos para popular várias tabelas que já tenho criadas.
Deparei-me com um desafio, uma vez que a Server Action SearchEntryList do conector LDAP retorna uma lista de Entry Records, tal como demonstra a seguinte imagem.
Tenho desenvolvida toda a lógica que preciso para popular as minhas tabelas com informações do utilizador, com base numa estrutura que criei e que armazena o valor dos 280 atributos, sendo que de momento utilizo esta lógica numa importação de ficheiro excel (perfeitamente funcional), no entanto, pretendo automatizar a importação e sincronização.
A minha questão é: Qual a maneira mais simples para proceder ao mapeamento dos valores retornados em cada atributo da query LDAP para a minha estrutura, tendo em conta que são 280 e tenho que percorrer a minha lista de resultados para comparar o atributo Name do AttributeExtension com o nome do atributo da minha estrutura?
Penso que será inevitável ter um ciclo para percorrer a AttributeList para cada Entry, mas gostaria de ter uma alternativa a um switch com 280 cases ou a vários ifs encadeados.
Outra alternativa que ponderei, foi fazer o mapeamento como está na imagem seguinte, mas precisava que o assign apenas fosse feito caso a condição do if se verificasse, e que fosse mantido o valor já guardado caso contrário, mas creio que a forma como implementei não funciona, pois será colocado o valor "True".
Agradeço desde já o apoio da comunidade!
João
Hello João Neto,
I've created this component for a use case similar to yours, to be used in a company that has custom attributes in the repository; to make it reusable, I used an approach to have a list of key-values as the output, but in your case your list is really big - 280 attrs.
I can not see much alternatives than these:
1 - Customize the component to return a different structure, containing the fields already mapped from LDAP;
2 - Create your own logic to loop over the list and assign to your structure - this can be done in multiple ways (as you are doing, or you can create some server actions as functions to have the code better organized; you can save the attributes on the database to avoid having them hardcoded...)
Let me know if this helps.
Tiago
Hello Tiago,
Thank you for your reply and for the useful component you shared with the community!
I'm thinking about the first alternative you suggested and I'll probably do that to avoid using a larger number of assignments in my logic.
Kind regards,
João Neto
Hello João,
Please consider that the main language used in the Forums is English :)
This way more people will be able to help you.
As such, please consider to translate your post to English.
Rui Barradas
Hello Rui,
Sorry, it was my first post!
Thank you very much, I'll take that into consideration in the future.
Regards,
Hi João Neto ,
Using AI translator, I understand that you are using [LDAP Connector] forge component for handling a large data, but the mapping of data you fill bit difficult because you are mapping more entries with a tables, that take lot of comparisons and consideration,
if you need to use lot of conditions and based on the result, need to show the table means you can use the Default System list actions from that you can filter the whole list without for each and lots of scenarios you can implement.
or you can use the Advanced SQL Query to solve your issue.
hope this helps
Hi!
Thanks a lot for your reply and sorry for posting in portuguese, I'll post in English from now on :)
I thought about using List Actions to filter the attributes and then assigning them to the structure, however I'll need as many ListFilter's as the number of attributes I have, so it's also a complex solution.