Jump to content
Sign in to follow this  
Joe Lusk

Problem with SQL get DataSet

Recommended Posts

I have a mySQL database setup and I can run SQL Get Value queries against it successful.

However when I try to run this query (SELECT preferredDC,preferredDCAID,Domain,defaultOU,defaultgroups,emailformat,emaildomain,logonformat FROM CustomerPortal.clientVars where AutomateID=12) as a SQL Get DataSet function it only returns "System.Data.DataSet" as the %sqldataset%

I formed the query using HiediSQL and it works fine in there.

SET: %sqlresult% = [SELECT preferredDC FROM CustomerPortal.clientVars WHERE AutomateID=12]  using DSN-xxxxxx;  WORKS

Set %sqldataset% = SQL Get DataSet:  SELECT preferredDC,preferredDCAID,Domain,defaultOU,defaultgroups,emailformat,emaildomain,logonformat FROM CustomerPortal.clientVars where AutomateID=12 using DSN=xxxxxx;   DOES NOT WORK

Any ideas?

 

Share this post


Link to post
Share on other sites

SQL Dataset will get all the rows from your query. You will then need to use SQL Fetch DataSet Row to get the data you are looking for. 

https://docs.connectwise.com/ConnectWise_Automate/ConnectWise_Automate_Documentation/070/240/050/040/020/040

Does a decent job of explaining it. You basically need to create a loop to go through all of your %sqldatasetrowcount% rows and do whatever it is you want to do with your data. 

  • Thanks 1

Share this post


Link to post
Share on other sites

I had done all of that and followed that document, but I just found my error. I didn't realize that the returned variables all had the prefix of sql.  So I was expecting @preferredDC@,@preferredDCAID@,@Domain@, etc when it actually returns @sqlpreferredDC@,@sqlpreferredDCAID@,@sqlDomain@, etc.

Well thanks for re-assuring what i did was correct.  🙂

 

 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×