Forum

HomeHomeCoreCoreBlue SkyBlue SkyOutput JSON nativelyOutput JSON natively
Previous
 
Next
New Post
8/19/2013 7:38 AM
 

thank you rmartin  your solution works perfectly with a small adjustment

================

{"Name":"Test - JSON Output Only","recordsPerPage":"0","enableAlphaFilter":"false","enablePageSelection":"false","enableRecordsPerPage":"false","enableCustomPaging":"false","enableExcelExport":false,"enableHide_OnNoQuery":false,"enableHide_OnNoResults":false,"enableAdvancedParsing":true,"enableCompoundIIFConditions":"true","enableQueryDebug":"false","enableQueryDebug_Edit":"false","enableQueryDebug_Admin":"false","enableQueryDebug_Super":"true","enableQueryDebug_Log":false,"enableQueryDebug_ErrorLog":false,"autoRefreshInterval":"","skipRedirectActions":"false","skipSubqueryDebugging":"false","enableAdmin_Edit":true,"enableAdmin_Admin":false,"enableAdmin_Super":false,"enableAJAX":"false","enableAJAXCustomPaging":"false","enableAJAXCustomStatus":"false","enableAJAXManual":"false","includeJavascriptUtilities":"false","includeJavascriptValidation":"false","javascriptOnComplete":"","enableMultipleColumnSorting":"false","ModuleCommunicationMessageType":"","showAll":"true","useExplicitSystemVariables":"false","enabledForcedQuerySplit":"false","searchItems":[],"queryItems":[],"listItems":[],"messageItems":[{"Index":1,"Level":0,"Parameters":{"Name":"OnLoad","RenderType":"0","skipDebug":"False","includeSearch":"False","includeExport":"False","includeImport":"False"},"ActionType":"Action-Region","ChildActions":[{"Index":2,"Level":0,"Parameters":{"Type":"<Action>","Name":"jsonOutput","Value":"{\"users\": [","SkipProcessing":"false","AssignmentType":"0"},"ActionType":"Action-Assignment","ChildActions":[]},{"Index":3,"Level":0,"Parameters":{"Name":"qryUsers","Query":"SELECT TOP(5) UserID\n      ,Username\n      ,FirstName\n      ,LastName\n      ,IsSuperUser\n      ,AffiliateId\n      ,Email\n      ,DisplayName\n      ,UpdatePassword\n      ,LastIPAddress\n      ,IsDeleted\n      ,CreatedByUserID\n      ,CreatedOnDate\n      ,LastModifiedByUserID\n      ,LastModifiedOnDate\n  FROM Users","IsProcess":"false","Connection":"","CacheName":"","CacheTime":"","CacheShared":"false"},"ActionType":"Action-Execute","ChildActions":[{"Index":4,"Level":0,"Parameters":{"Type":"&lt;Action&gt;","Name":"jsonOutput","Value":"{\"user\": {\n    \"UserID\": [UserID,qryUsers]\n    ,\"UserName\": \"[UserName,qryUsers]\"\n    ,\"FirstName\": \"[FirstName,qryUsers]\"\n    ,\"IsSuperUser\": \"[IsSuperUser,qryUsers]\"\n    ,\"AffiliateId\": \"[AffiliateId,qryUsers]\"\n    ,\"Email\": \"[Email,qryUsers]\"\n    ,\"DisplayName\": \"[DisplayName,qryUsers]\"\n    ,\"UpdatePassword\": \"[UpdatePassword,qryUsers]\"\n    ,\"LastIPAddress\": \"[LastIPAddress,qryUsers]\"\n    ,\"IsDeleted\": \"[IsDeleted,qryUsers]\"\n    ,\"CreatedByUserID\": \"[CreatedByUserID,qryUsers]\"\n    ,\"CreatedOnDate\": \"[CreatedOnDate,qryUsers]\"\n    ,\"LastModifiedByUserID\": \"[LastModifiedByUserID,qryUsers]\"\n    ,\"LastModifiedOnDate\": \"[LastModifiedOnDate,qryUsers]\"\n  }\n},","SkipProcessing":"false","AssignmentType":"1"},"ActionType":"Action-Assignment","ChildActions":[]}]},{"Index":5,"Level":0,"Parameters":{"Type":"<Action>","Name":"jsonOutput","Value":"{\"_comment_\" : \"validated at http://jsonlint.com/\"}]}","SkipProcessing":"false","AssignmentType":"1"},"ActionType":"Action-Assignment","ChildActions":[]}]},{"Index":6,"Level":0,"Parameters":{"Name":"OnRender","RenderType":"0","skipDebug":"False","includeSearch":"False","includeExport":"False","includeImport":"False"},"ActionType":"Action-Region","ChildActions":[{"Index":7,"Level":0,"Parameters":{"Type":"CONTENTTYPE","Name":"","Value":"text/json","SkipProcessing":"false","AssignmentType":"0"},"ActionType":"Action-Assignment","ChildActions":[]},{"Index":8,"Level":0,"Parameters":{"Type":"Detail-NoQuery","GroupStatement":"","GroupIndex":"","Value":"[jsonOutput,Action]","Connection":"","Filter":"","CacheTime":"","CacheName":"","CacheShared":"false"},"ActionType":"Template","ChildActions":[]}]}],"query":"","filter":"","customConnection":"","listItem":"","listAItem":"","defaultItem":"","noqueryItem":"","SearchQuery":"","SearchTitle":"","SearchLink":"","SearchAuthor":"","SearchDate":"","SearchKey":"","SearchContent":"","SearchDescription":"","Version":"20","enableAJAXPaging":"false","enableAJAXPageHistory":"false","customAJAXPageHistory":"","disableOpenScript":false,"enableSilverlight":false,"javascriptInclude":[],"ConfigurationID":"13769227-4559-13B2-1C4E-6FBE1EE443B6","Index":"Test - JSON Output Only"}

======================


New Post
12/20/2013 7:16 AM
 

In the latest release build you can use the tojson parameters within the subquery to generate a JSON representation of each of the tables within your query. For example:


{SUBQUERY,Name="Test",Query="
Select top 1 * from Lists
Select top 1 * from Users
",tojson="Lists,Users"}


The output of this looks something like this:

{"LISTS":{"Columns":[{"Name":"EntryID","Type":"Int32","ReadOnly":"False","Length":"-1"},{"Name":"ListName","Type":"String","ReadOnly":"False","Length":"-1"},{"Name":"Value","Type":"String","ReadOnly":"False","Length":"-1"},{"Name":"Text","Type":"String","ReadOnly":"False","Length":"-1"},{"Name":"ParentID","Type":"Int32","ReadOnly":"False","Length":"-1"},{"Name":"Level","Type":"Int32","ReadOnly":"False","Length":"-1"},{"Name":"SortOrder","Type":"Int32","ReadOnly":"False","Length":"-1"},{"Name":"DefinitionID","Type":"Int32","ReadOnly":"False","Length":"-1"},{"Name":"Description","Type":"String","ReadOnly":"False","Length":"-1"},{"Name":"PortalID","Type":"Int32","ReadOnly":"False","Length":"-1"},{"Name":"SystemList","Type":"Boolean","ReadOnly":"False","Length":"-1"},{"Name":"CreatedByUserID","Type":"Int32","ReadOnly":"False","Length":"-1"},{"Name":"CreatedOnDate","Type":"DateTime","ReadOnly":"False","Length":"-1"},{"Name":"LastModifiedByUserID","Type":"Int32","ReadOnly":"False","Length":"-1"},{"Name":"LastModifiedOnDate","Type":"DateTime","ReadOnly":"False","Length":"-1"}],"Rows":[{"Columns":["1","Country","AD","Andorra","0","0","0","-1","","-1","True","","","",""]}]}},{"USERS":{"Columns":[{"Name":"UserID","Type":"Int32","ReadOnly":"False","Length":"-1"},{"Name":"Username","Type":"String","ReadOnly":"False","Length":"-1"},{"Name":"FirstName","Type":"String","ReadOnly":"False","Length":"-1"},{"Name":"LastName","Type":"String","ReadOnly":"False","Length":"-1"},{"Name":"IsSuperUser","Type":"Boolean","ReadOnly":"False","Length":"-1"},{"Name":"AffiliateId","Type":"Int32","ReadOnly":"False","Length":"-1"},{"Name":"Email","Type":"String","ReadOnly":"False","Length":"-1"},{"Name":"DisplayName","Type":"String","ReadOnly":"False","Length":"-1"},{"Name":"UpdatePassword","Type":"Boolean","ReadOnly":"False","Length":"-1"},{"Name":"LastIPAddress","Type":"String","ReadOnly":"False","Length":"-1"},{"Name":"IsDeleted","Type":"Boolean","ReadOnly":"False","Length":"-1"},{"Name":"CreatedByUserID","Type":"Int32","ReadOnly":"False","Length":"-1"},{"Name":"CreatedOnDate","Type":"DateTime","ReadOnly":"False","Length":"-1"},{"Name":"LastModifiedByUserID","Type":"Int32","ReadOnly":"False","Length":"-1"},{"Name":"LastModifiedOnDate","Type":"DateTime","ReadOnly":"False","Length":"-1"}],"Rows":[{"Columns":["1","host","SuperUser","Account","True","","host@change.me","SuperUser Account","False","127.0.0.1","False","-1","7/3/2012 11:05:04 AM","-1","12/20/2013 11:11:25 AM"]}]}}


Kevin M Schreiner
Open Web Studio
PayPal - The safer, easier way to pay online!
Previous
 
Next
HomeHomeCoreCoreBlue SkyBlue SkyOutput JSON nativelyOutput JSON natively


 

New York, NY • Baltimore, MD • Vienna, VA • St. Louis, MO • Seattle, WA • info@openwebstudio.com

Bookmark & Share Bookmark and Share