1 Reply Latest reply on Dec 11, 2015 4:07 PM by tdanner

    Getting very odd results with SWQL query when put in a resource on a web page?!

    Craig Norborg

      Playing around with an idea to have a simple custom search by user-id from UDT data that I can put on a web page.  The query itself works great in SWQL studio, but when I put it on a webpage I get very odd results compared to what I get when I run it in SWQL studio...

       

      The base query is fairly simple:

       

      SELECT TOP 100 U2IPAC.User.AccountName, LogonDateTime, IPAddress, ('/Orion/UDT/UserDetails.aspx?NetObject=UU:' + ToString(UserID)) AS [_LinkFor_AccountName]

      FROM Orion.UDT.UserToIPAddressCurrent U2IPAC

      ORDER BY LogonDateTime DESC

       

      I've also put in a "search" query that appears to work fine.  I've included it and how I set up the resource below.  This resource I added to my main UDT page.

       

      When I run the query above in SWQL studio it works exactly as I would think it would.  Returns a number of userID's, IP Addresses, etc. etc for users that UDT says has recently logged in.   However, when I put it into the web page as shown below, the results are all 1 username.  I did notice that the "UserID" variable in the Orion.UDT.User happens to have the value of "1" for this user.   The dates and times and IP addresses that are returned on the webpage for that user ID are all valid, but its missing some.

       

      By "missing some" I mean exactly that.   If I rewrite the query above to give me the logins of that specific username with a "WHERE U2IPAC.User.AccountName LIKE '%userid%'", I get a list of the last 100 logins of that user.   However, what is returned when I have it on the webpage is missing the first 2 from that list, then it has the next 2, then its missing the next 3, then it has the rest...   I've tried everything I can think of to try and figure out why its doing this.  Any suggestions? 

       

      Is something happening to my query that I don't know about?   Is it somehow filtering or restricted on "UserID = 1"?  

       

      ## Search Query

      SELECT TOP 1 U2IPAC.User.AccountName, LogonDateTime, IPAddress, ('/Orion/UDT/UserDetails.aspx?NetObject=UU:' + ToString(UserID)) AS [_LinkFor_AccountName]

      FROM Orion.UDT.UserToIPAddressCurrent U2IPAC

      WHERE (U2IPAC.User.AccountName LIKE '%${SEARCH_STRING}%')

      ORDER BY LogonDateTime DESC

       

      UDTUserSearch.jpg