Client Management Suite

 View Only
  • 1.  Custom report help

    Posted Nov 23, 2010 06:12 PM

    I decided to write the sql for this report manually since for some reason I didn't see vComputer as an option to select in the report builder (ns 6).  I was able to put together the results I'm looking for in the query via SQL Server Management Studio.  Here is my code:

     

    SELECT
    vc.[Name]
    ,vc.[User]
    ,vc.[OS Name]
    --,vc.[OS Version]
    ,vc.[IP Address]
    ,cd.[Comment] AS 'Comment'
    ,hw.[System Manufacturer] AS 'Manufacturer'
    ,hw.[System Model Number] AS 'Model'
    ,max(mem.[Total Physical Memory]) AS 'Memory'
    ,hw.[Serial Number] AS 'Serial '
    ,hw.[Asset Tag] AS 'Asset Tag' 
    FROM [AltirisNSData_Production].[dbo].[vComputer] vc
    INNER JOIN [AltirisNSData_Production].[dbo].[Inv_AeX_Computer_Description] cd
    ON vc.[Guid] = cd.[_ResourceGuid] 
    INNER JOIN [AltirisNSData_Production].[dbo].[Inv_AeX_HW_Serial_Number] hw
    ON vc.[Guid] = hw.[_ResourceGuid] 
    INNER JOIN [AltirisNSData_Production].[dbo].[Inv_AeX_AC_Primary_User] pu
    ON vc.[Guid] = pu.[_ResourceGuid] 
    INNER JOIN [AltirisNSData_Production].[dbo].[Inv_AeX_HW_Memory_Changes] mem
    ON vc.[Guid] = mem.[_ResourceGuid] 
    WHERE vc.[Name] LIKE 'of%' 
    AND cd.[Comment] LIKE '%' 
    AND hw.[System Model Number] LIKE '%' 
    GROUP BY vc.[Name], 
    vc.[User], 
    vc.[OS Name],
    vc.[IP Address],
    cd.[Comment], 
    hw.[System Manufacturer], 
    hw.[System Model Number], 
    mem.[Total Physical Memory], 
    hw.[Serial Number], 
    hw.[Asset Tag]
    order by name desc
     
    And yes I know, there is no Inv_AeX_Computer_Description out of the box.  Thats a custom inv.  
     
    So when I try to put this sql in a report, it error's out.  I out out "[AltirisNSData_Production].[dbo]." because it didn't seam necessary in the report and other reports never showed that.
     
    The error I get in the console is "Incorrect syntax near 'cd'."  But the code works working directly with the sql.  Thoughts?


  • 2.  RE: Custom report help

    Posted Nov 24, 2010 08:15 AM

    generally it'll tell what line as well, which helps know WHICH "CD" it's complaining about.  Did it say?



  • 3.  RE: Custom report help

    Posted Nov 24, 2010 08:18 AM

    I can't look at the syntax of that field.  BTW, why are you specifying the DB and DBO classifications in this report?  All you need to do is:

    vComputer

    you don't need:

     [AltirisNSData_Production].[dbo].[vComputer]

    The DB and dbo specs are only required if you're going against a DB that is NOT the Altiris DB.



  • 4.  RE: Custom report help

    Posted Nov 24, 2010 08:42 AM

    When I put the report into Altiris, I replaced the fully qualified db name with just the vComputer short name.

    As for the error, it doesn't show an error line as seen in the screen shot.



  • 5.  RE: Custom report help

    Posted Nov 24, 2010 09:22 AM

    I hate that thing.  I just use SQL directly.  However, hmmm...  usually when I see something like this, it's misleading.  That is, the error isn't where it says it is.

    But you say that, if you cut/paste this directly into SQL mgmt studio, it works?



  • 6.  RE: Custom report help

    Posted Nov 24, 2010 09:26 AM

    I didn't see anywhere in the SQL where you use a field or connection to PW.  Just thought I'd ask.



  • 7.  RE: Custom report help
    Best Answer

    Posted Nov 24, 2010 11:12 AM
      |   view attached

    ....I not quite sure what I changed that made this work, but I got it working.  Only think I can think of that I changed was my process of creating the report.  I created a brand new report this time with the option to enter sql directly.  I wasn't doing that before.  I was just taking the report I generated with the wizard and changing the sql at the end of that.  I was just lazy because I didn't want to re-enter the parameter prompts.  Final sql attached.

    Attachment(s)

    txt
    AssetReport.sql_.txt   999 B 1 version


  • 8.  RE: Custom report help

    Posted Nov 24, 2010 11:22 AM

    And this is one reason why.  The builder tosses in things that I don't always want.  The nice thing is it will include things like security context stuff I don't put in, but the easiest way to get a good report is to do it in SQL, then paste in to the report directly.

    Grats on fixing it!!