Query Builder Component?

I need to add some query capabilities to an AD report and the current solution is pretty basic in that you can just enter a valid LDAP query into a textbox to set the scope of the report.

I was thinking of something like the https://react-querybuilder.js.org/ that could be used for various other things too like database query tools.

Has anybody done something similar?

This looks cool. Go build it :+1:
This is possible to build as a custom component should you so choose to do so

Hey, I’ve been looking at your blog and reviewing the available PU documentation so I might just give this a go. React is not something I have really played with so its gonna be a bit of a learning curve :slight_smile:

1 Like

So I did build this last night as I was curious. But the fields will need to pass as json. Sure I done this in this past but yeah this component will work in PSU. Might have some more tinkering tonight as it’s just the function within powershell stopping it from all working as not passing the field param in correct way atm

Boom! I built it tonight :bomb:

This did take a bit of time to figure out fully not going to lie as it has been a while since I cooked up a custom component…Should be able to use a button to gather the values

 New-UDQueryBuilder -Fields {New-UDQueryBuilderField -Label "First Name" -Name "firstname"}

Is how this will work, that is the code I used to generate this…so was thinking of doing some more reading on this to maybe output to various languages or something.

Not sure why other people do not get more interested in building custom components…as it makes any idea like you had possible

Like this little more reading of documentation to now output the SQL code behind the query builder

You can dynamically add the fields via the scriptblock, the query dynamically changes


Now that looks awesome! I hadn’t even had a chance to look at it yet as I was on-site at our London studio and only just got back.

Are you gonna push it to the gallery?

Yeah I can look at putting this onto the gallery and marketplace. After I got it working last night, I thought I would try and update the npm packages to reduce any vulnerabilities and well it broke it. So I will need to rebuild it.
Plus I am thinking if I was to add the code output of SQL into a DIV then give that a specific class name, you should then be able to dynamically read the output of the SQL to feed that into a query at the press of a button.
It would be great to see others taking more of an interest in building things for this amazing bit of software. I mean I got 5 daughters, 4 cats and 3 dogs plus a full time job. So would be good to get others building components for the masses.
I haven’t done any blogs in a long time, so as I need to rebuild it anyway I could look at documenting it as I do it, step-by-step to encourage others to get building :smile_cat:

Well you are doing a good job of convincing me :slight_smile: I have 4 kids a full-time job and a COD addiction to contend with :slight_smile:

I have published this to the powershell gallery.
As I had to rebuild it I took notes and screenshots for a brief tutorial which should help those wishing to build custom components. I need to upload that to my blog site. So will post that link with instructions. But here is the link to get it

@andrew.wood.wb I think you owes me a slap-up-meal in London for all the grafting I done for you on a Friday evening. :smile_cat: so I only went and built a website to show how this was done

Powershell Universal (powershelluniversalcustomcomponents.netlify.app)

I spent time taking the screen shots, and doing it all from scratch. This should hopefully be an additional help to the existing written guide.

1 Like