Quantcast
Channel: Support Portal
Viewing all articles
Browse latest Browse all 20315

Re : Sorry an error has occurred - Custom Report (CMDB)

$
0
0
Hi,

This is probably because of that the report wizard adds the aggregate function MAX() in the SELECT of a query. If you have a possibility to check the query that is executing then you would see that function in every column.

  1. SELECT MAX("workstation"."WORKSTATIONNAME") AS "Machine Name", MAX("product"."COMPONENTNAME") AS "Product", MAX(compDefLaptop.ISLAPTOP) AS "Is Laptop", MAX("workstation"."LOGGEDUSER") AS "Last Logged In User", MAX("aaaUser"."FIRST_NAME") AS "User"

I don't remember which update fixed this issue and changes the SELECT to

  1. SELECT MAX("workstation"."WORKSTATIONNAME") AS "Machine Name", MAX("workstation"."LOGGEDUSER") AS "Last Logged In User", MAX("product"."COMPONENTNAME") AS "Product", MAX("aaaUser"."FIRST_NAME") AS "User", MAX(CASE WHEN CAST(compDefLaptop.ISLAPTOP AS CHAR(5)) IS NULL THEN 0 WHEN CAST(compDefLaptop.ISLAPTOP AS CHAR(5)) = '0' THEN 0 ELSE 1 END) AS "Is Laptop"  FROM "SystemInfo" "workstation"

When I've got this error and analyzed it, I modified the query and it worked like a charm :)

  1. SELECT "workstation"."WORKSTATIONNAME" AS "Machine Name", "product"."COMPONENTNAME" AS "Product", compDefLaptop.ISLAPTOP AS "Is Laptop", "workstation"."LOGGEDUSER" AS "Last Logged In User", "aaaUser"."FIRST_NAME" AS "User" FROM "SystemInfo" "workstation" 

  2. LEFT JOIN "Resources" "resource" ON "workstation"."WORKSTATIONID"="resource"."RESOURCEID" 
  3. LEFT JOIN "ComponentDefinition" "product" ON "resource"."COMPONENTID"="product"."COMPONENTID" 
  4. LEFT JOIN "ComponentDefinitionLaptop" "compDefLaptop" ON "product"."COMPONENTID"="compDefLaptop"."COMPONENTID" 
  5. LEFT JOIN "ResourceOwner" "rOwner" ON "resource"."RESOURCEID"="rOwner"."RESOURCEID" 
  6. LEFT JOIN "ResourceAssociation" "rToAsset" ON "rOwner"."RESOURCEOWNERID"="rToAsset"."RESOURCEOWNERID" 
  7. LEFT JOIN "SDUser" "sdUser" ON "rOwner"."USERID"="sdUser"."USERID" 
  8. LEFT JOIN "AaaUser" "aaaUser" ON "sdUser"."USERID"="aaaUser"."USER_ID"  

  9. WHERE (ISSERVER='0') 




----------------------
SDPAdmins.pl - Piszemy o SDP i nie tylko.
https://www.facebook.com/SDPAdminspl-128393794236437/ - Like us on Facebook :)

Viewing all articles
Browse latest Browse all 20315

Trending Articles