<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://community.appian.com/cfs-file/__key/system/syndication/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>using JSONpath in a query</title><link>https://community.appian.com/discussions/f/plug-ins/23521/using-jsonpath-in-a-query</link><description>I have a setup where a particular column of a table contains a JSON object that I need to search through. I basically want to go through each row in that table and use JSONpath to filter out results, but I am unsure how to apply that to an appian query</description><dc:language>en-US</dc:language><generator>Telligent Community 12</generator><item><title>RE: using JSONpath in a query</title><link>https://community.appian.com/thread/97233?ContentTypeID=1</link><pubDate>Tue, 05 Jul 2022 11:38:13 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:232e6814-8b1c-458b-b99f-ca0f3069d529</guid><dc:creator>vishalk2742</dc:creator><description>&lt;p&gt;I am working on the similar use case, any luck with JSON_TABLE function. I see Appian does not have much to explore but we have some options from DB and Java API which can be useful for this particular use case.&amp;nbsp;&lt;br /&gt;Appreciate if you have share any tips / workaround you did for this use case&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: using JSONpath in a query</title><link>https://community.appian.com/thread/90214?ContentTypeID=1</link><pubDate>Tue, 25 Jan 2022 18:18:50 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:8a4d6745-4bf4-4483-88c2-1e22ab421ee8</guid><dc:creator>Marco</dc:creator><description>&lt;p&gt;I hadn&amp;#39;t thought of that. Hmm... In this particular case the json objects are uniform so the table could be set up to take everything in, I suppose. I&amp;#39;d probably need to get permission to do things that way though. I&amp;#39;ll take it up with them to see. Thanks for the idea.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: using JSONpath in a query</title><link>https://community.appian.com/thread/90195?ContentTypeID=1</link><pubDate>Tue, 25 Jan 2022 17:03:53 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:47ff0438-2911-4506-b372-a4b0c12f4b0b</guid><dc:creator>Stewart Burchell</dc:creator><description>&lt;p&gt;Are you genuinely constrained in how the data is populated into the DB? For example: the current process that loads the data (as a PK, JKSON blob pair) - could that be expanded to extract the data from the incoming JSON and load into a normalized model that you could then implement&amp;nbsp;as you were initially hoping to do so using standard query entity calls?&amp;nbsp; In short: is there an opportunity to move the problem upstream to the database load process, rather than where you&amp;#39;re currently trying to solve it?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: using JSONpath in a query</title><link>https://community.appian.com/thread/90190?ContentTypeID=1</link><pubDate>Tue, 25 Jan 2022 16:59:58 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:34378ed9-4314-443b-b631-6f362807976a</guid><dc:creator>Marco</dc:creator><description>&lt;p&gt;We&amp;#39;re using MariaDB. We&amp;#39;ve been looking into using json_table, but haven&amp;#39;t figured out how to get it to work yet. Thanks for the tip.&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: using JSONpath in a query</title><link>https://community.appian.com/thread/90189?ContentTypeID=1</link><pubDate>Tue, 25 Jan 2022 16:59:28 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:f32471bc-96e2-4bcd-9e18-a5571e48fee4</guid><dc:creator>Marco</dc:creator><description>&lt;p&gt;Thanks, that&amp;#39;s another option we&amp;#39;ve been looking into. Haven&amp;#39;t gotten it to function yet, but it seems promising at least.&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: using JSONpath in a query</title><link>https://community.appian.com/thread/90185?ContentTypeID=1</link><pubDate>Tue, 25 Jan 2022 16:32:42 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:41a0db89-791b-4326-b749-0a90772377cf</guid><dc:creator>Chris</dc:creator><description>&lt;p&gt;I would lean toward the DB side as well as you may have functions available that could be used to create a view to make this much easier on the Appian side.&amp;nbsp; What DB/version are you on?&amp;nbsp; For example in MSSQL you may be able to take advantage of &lt;a href="https://www.sqlshack.com/how-to-parse-json-in-sql-server/"&gt;OPENJSON()&lt;/a&gt;, or &lt;a href="http://nimishgarg.blogspot.com/2020/06/parse-json-data-in-oracle-database.html"&gt;JSON_VALUE / JSON_TABLE&lt;/a&gt; in Oracle, etc.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: using JSONpath in a query</title><link>https://community.appian.com/thread/90137?ContentTypeID=1</link><pubDate>Tue, 25 Jan 2022 08:51:36 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:ab140d0c-0eb7-4b96-88c1-fec0d80fa252</guid><dc:creator>Stewart Burchell</dc:creator><description>&lt;p&gt;A possible alternative, depending on the database you&amp;#39;re working with, is that the DB might support JSON functions and you could use that to conduct the relevant filtering. That would mean you calling a Stored Procedure and either designing it in such a way as to be generic to support any type of query, or having one Stored Proc per concrete query type you know it needs to support. But, as I said, entirely dependent upon your DB&amp;#39;s support for JSON functions.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: using JSONpath in a query</title><link>https://community.appian.com/thread/90117?ContentTypeID=1</link><pubDate>Mon, 24 Jan 2022 21:31:56 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:3d52962d-e98f-40b1-bbde-59724ab7ffaa</guid><dc:creator>Mike Schmitt</dc:creator><description>[quote userid="71398" url="~/discussions/f/plug-ins/23521/using-jsonpath-in-a-query/90116#90116"]As for filtering down to a more reasonable set of rows, there are no criteria that I can filter outside of the json stuff [/quote]
&lt;p&gt;I was thinking along the lines of pre-filtering based on the JSON information (if there&amp;#39;s anything you can directly filter on, like the &amp;quot;gender&amp;quot; example we did before).&amp;nbsp; If not then you&amp;#39;ll have to skip this part.&lt;/p&gt;
[quote userid="71398" url="~/discussions/f/plug-ins/23521/using-jsonpath-in-a-query/90116#90116"]read only grids seem to handle whatever logic is needed to bring in the data in smaller batches to see on individual pages[/quote]
&lt;p&gt;This is all handled on the back end by a!queryEntity with paging info.&amp;nbsp; Read-only grids are merely a visual manifestation of this.&amp;nbsp; Problem being, if there&amp;#39;s no &amp;quot;text includes&amp;quot; filtering you can do on your JSON column, and no way to otherwise break this data out to other proper columns, there&amp;#39;s not much you can do that will allow you to do very much inside of a!queryEntity.&amp;nbsp; At this point I&amp;#39;d be considering whether it&amp;#39;s possible to build a view that breaks out some of your json data (at least for columns that will always exist) into discrete columns. MariaDB has various JSON functionality available but as far as this specific thing, I haven&amp;#39;t necessairly tried this.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: using JSONpath in a query</title><link>https://community.appian.com/thread/90116?ContentTypeID=1</link><pubDate>Mon, 24 Jan 2022 20:42:20 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:66f791bd-ec6d-4746-aa66-1c66bce941da</guid><dc:creator>Marco</dc:creator><description>&lt;p&gt;Believe me, if I could store the data in traditional db columns, I would. It would make everything a lot easier. Unfortunately, the format of the data is out of my hands.&lt;/p&gt;
&lt;p&gt;As for filtering down to a more reasonable set of rows, there are no criteria that I can filter outside of the json stuff as the only two fields on the table are the ID and the json object.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;When you pass a query into them, read only grids seem to handle whatever logic is needed to bring in the data in smaller batches to see on individual pages. Is there some way to apply that sort of logic elsewhere? Loop through the entire data, but in smaller, more manageable batches?&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: using JSONpath in a query</title><link>https://community.appian.com/thread/90115?ContentTypeID=1</link><pubDate>Mon, 24 Jan 2022 20:15:17 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:99474b98-4c3b-4f52-9f4f-db7d74e4e87c</guid><dc:creator>Mike Schmitt</dc:creator><description>&lt;p&gt;For that sort of thing to work with a!queryEntity, you&amp;#39;d need to store that data in traditional DB columns, unless you&amp;#39;re prepared to do something closer to what Stewart suggested and pre-query a bunch of rows and manually filter through them on the Appian side.&amp;nbsp; One note here would be, depending on your use case you could potentially limit your pre-query to a more reasonable set of rows by filtering first on other criteria.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: using JSONpath in a query</title><link>https://community.appian.com/thread/90114?ContentTypeID=1</link><pubDate>Mon, 24 Jan 2022 19:51:07 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:38e7b085-448f-44cc-be12-89d7d7d3f285</guid><dc:creator>Marco</dc:creator><description>&lt;p&gt;I ran into an issue trying that. I may need to compare values as part of the filtering process. For example, I might want to see if their salary field is above a particular threshold. Includes wouldn&amp;#39;t be sufficient in such a case.&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: using JSONpath in a query</title><link>https://community.appian.com/thread/90112?ContentTypeID=1</link><pubDate>Mon, 24 Jan 2022 19:06:36 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:30646b7e-4912-4a21-bd4d-d25bf8e819ff</guid><dc:creator>Marco</dc:creator><description>&lt;p&gt;I suppose that&amp;#39;s one way to do it. I was just being told to make use of JSONpath as a possibly more performant solution. But if it won&amp;#39;t work, it won&amp;#39;t work.&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: using JSONpath in a query</title><link>https://community.appian.com/thread/90111?ContentTypeID=1</link><pubDate>Mon, 24 Jan 2022 19:04:53 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:373c2f57-45c2-4257-ba64-c883bf44c9bf</guid><dc:creator>Marco</dc:creator><description>&lt;p&gt;The table only contains 2 fields at the moment: a primary key and a json object, so that&amp;#39;s not necessary.&lt;/p&gt;
&lt;p&gt;The problem is I can&amp;#39;t seem to apply jsonpath without getting everything first and once I hit around 3,000 rows, I run out of memory.&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: using JSONpath in a query</title><link>https://community.appian.com/thread/90100?ContentTypeID=1</link><pubDate>Mon, 24 Jan 2022 18:04:39 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:dc73f83a-7f68-4714-9fcc-961dce2734b1</guid><dc:creator>Stewart Burchell</dc:creator><description>&lt;p&gt;Could your initial query ONLY return the JSON column and the Primary Key (and any other applicable selection criteria that will work with standard filters) , and then you filter out those rows that don&amp;#39;t match your JSONpath expression, and then make a second query to get all of the other data you need? (yes, it&amp;#39;s two separate queries, but might perform better than fetching the full length and breadth of the table and then filtering locally)&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: using JSONpath in a query</title><link>https://community.appian.com/thread/90099?ContentTypeID=1</link><pubDate>Mon, 24 Jan 2022 17:52:45 GMT</pubDate><guid isPermaLink="false">d3a83456-d57b-489c-a84c-4e8267bb592a:e2797588-8735-4c4e-8a67-aaf4377f4594</guid><dc:creator>Mike Schmitt</dc:creator><description>&lt;p&gt;I don&amp;#39;t believe query filters can make use of jsonPath whatsoever.&amp;nbsp; Wouldn&amp;#39;t it generally be sufficient to use an &amp;quot;includes&amp;quot; filter for the json attribute, i.e. where the json column includes `&lt;code&gt;&amp;quot;gender&amp;quot;:&amp;quot;female&amp;quot;&lt;/code&gt;` ?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>