Displaying multiple columns in Web Interface

I have a script which queries a SQL table I created to add new users to a selected AD group on creation.

The table originally had 1 column - AD Group Name, which returned all possible groups for the helpdesk to select from in a dropdown list in the web interface and then added the new user to the group selected. The selection is stored in a virtual attribute which I then query in order to add the user to the correct AD group The helpdesk have requested the groups description be displayed in addition to the name so they could select the correct one based on that information.

I added a new column to the table - AD Group Description. When I query the table, both the name and description are returned in a string array. I can see the results in the output if I check it in powershell. Is there a way to have the dropdown list on the web interface display a whole row returned from the sql table i.e. both the AD Group Name and Group Description?

  • What if you were to format the groups names thus for the drop down:

    MyGroupName (Here's a description)

    ...and then have some code strip off the description just before the user is added to the group?


  • As far as the SQL side of this goes, to pull the values for the dropdown it would look something like this:

    SELECT CONCAT(Group_Name,'<space> ',GroupDescription) FROM MyTable

    You would then load this list into your virtual attribute.

  • Many thanks for this tip/pointer, it has enabled me to achieve what i needed, joining the values from the 2 columns together gave me a datarow object output, which I then looped through to convert to an array of string objects which ARS was happy with to display in the dropdown list. Then storing the selected item in the virtual attribute I had created and extracing the group name out as a substring allowed the group membership addition to take place as desired.