Graphics

 View Only
  • 1.  Reordering JSON data dynamically

    Posted 05-07-2024 07:30

    I understand that it is possible to reorder data via SQL Queries via this tutorial. - Using SQL Queries to Automatically Order External Data Dynamically

    But is it possible to reorder JSON data dynamically in datalinq?

     



    ------------------------------
    Jordan Allen - Mix Effect Media XPression
    London United Kingdom
    ------------------------------


  • 2.  RE: Reordering JSON data dynamically

    Posted 05-07-2024 12:47

    Do you know anyone who knows Python? They could make you a file that reoarders the json file. 

    Alternatively I think you'd need to reorder once its inside XPression already. 

    What are you try to do because you can do pretty decent searches on XML that I think would work on json such as;

    team\player<<2>oncourt=Y>\stats 



    ------------------------------
    Simon Redmile
    Senior Graphic Programmer & Designer
    Ross Video
    Bristol United Kingdom
    ------------------------------



  • 3.  RE: Reordering JSON data dynamically

    Posted 05-08-2024 11:34

    In Version 10.5 and higher, You can use <max>, <max-1>, <max-2>, etc., to find the highest, second highest, third highest element, etc., in your array:

    in DataLinq, when searching for data in a tree based DataLinq, the <index> field can now use the keyword "max" to return the element from the highest array index.  e.g. scoring\plays<max>\description will return the description from the highest play element.  <max-1> would return the second highest element, etc.



    ------------------------------
    Jeff Mayer
    Ross Video
    ------------------------------



  • 4.  RE: Reordering JSON data dynamically

    Posted 05-08-2024 13:12

    Dude I totally forgot this feature was a thing! Thank you!



    ------------------------------
    Simon Redmile
    Senior Graphic Programmer & Designer
    Ross Video
    Bristol United Kingdom
    ------------------------------



  • 5.  RE: Reordering JSON data dynamically

    Posted 05-09-2024 05:57

    This is great. Thank you for this. Can you also do the same for <min>, or is it exclusive to Max value? I tested it with <min>, and it didn't seem to work.

    Do you have some document that lists all these functions for the <index> for future reference? 



    ------------------------------
    Jordan Allen - Mix Effect Media XPression
    London United Kingdom
    ------------------------------



  • 6.  RE: Reordering JSON data dynamically

    Posted 05-09-2024 09:46

    Match Multiple Search Criteria

    The XML/JSON datalinqs can now search multiple attributes or elements to return a node that matches all search criteria.  e.g. players<team=NY;jersey=10>

    Look For Increments of an Index Value or Search Criteria

    A DataLinq comparison key such as <club=ross> can now have an additional index parameter as well, like so <club=ross<2>>, which will retrieve the second item matching the key.

    Search Through Child Elements and Attributes

    The XML datalinq types can search for children elements/attributes in a level of the tree by using "childname.field=%key%".  e.g. player<info.jersey=%num%>\name

    Find the Highest Index Value of an Element

    The <index> field can now use the keyword "max" to return the element from the highest array index.  e.g. scoring\plays<max>\description will return the description from the highest play element.  <max-1> would return the second highest element, etc



    ------------------------------
    Jeff Mayer
    Ross Video
    ------------------------------



  • 7.  RE: Reordering JSON data dynamically

    Posted 08-09-2024 09:39

    Hi Jeff, 

    I hope you are well. I am returning to this for another project but have little luck with it working. I believe I am doing everything correctly. Can you look at this screenshot and let me know what you think? 



    ------------------------------
    Jordan Allen - Mix Effect Media XPression
    London United Kingdom
    ------------------------------



  • 8.  RE: Reordering JSON data dynamically

    Posted 08-15-2024 22:18

    Hey Jordan;

    <max> returns the LAST item in the list, not the item with the highest value

    If you can get the data from your URL via XML instead of JSON, I could look to help you write an XSLT (XSL Transformation file) that would load in along-side the XML you get in your data to produce a transformed result.



    ------------------------------
    Zachary Fradette
    United States
    ------------------------------