Jump to content

drjdpowell

Members
  • Posts

    1,914
  • Joined

  • Last visited

  • Days Won

    166

drjdpowell last won the day on May 19

drjdpowell had the most liked content!

9 Followers

Profile Information

  • Gender
    Male
  • Location
    Oxford, UK

LabVIEW Information

  • Version
    LabVIEW 2017
  • Since
    1999

Recent Profile Visitors

13,109 profile views

drjdpowell's Achievements

  1. Again, I've never used PPLs, but that seems wrong. Why can't you put a class in a library/PPL?
  2. I have never used PPLs, but my understanding is that you would first need to put the PQ library in its own PPL, and have all other code call that PPL. It looks like you have instead made independent copies of PQ in each PPL.
  3. Hi Dr. Powell,

    I am using your jsontext package. It works very well and I thank you for your efforts. I believe I found a bug and wish to bring it to your attention. I get strange results from a map. 

     

    image.png.6e0804669bfa7ea023d84e0dc00d204c.png

    Json Set Bug.vi

    1. drjdpowell
    2. reniam

      reniam

      Thank you Dr. Powell.

      Unfortunately the answer is to use an array instead of a set. Putting the label size in the label would cause garbled text when NI fixes the bug. Not too big a thing, but I had to add code to order and remove duplicates. Thank you again.

  4. Here is a quick hack from some existing INI parsing code I had. See if this works on NI-MAX files. This VI converts the INI items to JSONpath notation, converts the values to JSON strings unless already a valid JSON value (such and numbers, true, etc.), and uses the JSONtext VIs "Unflatten JSONpath Array to Object" and "Pretty Print" to convert to JSON. INI to JSON Example.vi
  5. JSON TO CLUSTER AND CLUSTER TON JSON :
    hi, 
    please I have a little problem in labview programming (json to cluster and cluster to json) I want to convert <Json string> to a cluster, to write information in it and I used your Json API command to convert this cluster again times in json, but I'm not getting the ordered result like before.
    do you have any other way to do it?

     

     
     
     

    image.png

    1.PNG

    2.PNG

    3.PNG

    4.PNG

  6. Good luck AQ, Hope your new employer still lets you attend a conference or two in Europe.
  7. Ah, it's because I added submenus in last release, and this added '_1' onto teh menu name. I'll fix that.
  8. That is the Project I use to develop the library; it isn't meant to be used after install (and doesn't update the various paths, such as to teh examples). I should probably not include it in the VIPM. If you'd like to fork the package and develop it, I'd recommend forking the Git repo. That menu should have been installed by VIPM, though.
  9. JSONpath doesn't have a specification, unfortunately, and so you can't really rely on different implementations matching on edge cases. I also haven't implemented everything (just due to teh effort required that I don't have time for).
  10. BTW, you should probably explore the "Advanced" subpallet of JSONtext, in particular "Difference.vi" and "Flatten JSON Object to JSONpath Array", as they are useful for this kind of stuff.
  11. That would be a perfectly good choice. You could also use an array of paths like '$[n].Enabled' and call Set Item in a loop. Aside: Note that you could also use a JSON Object rather than an array to hold your list of targets. Like this: { "My Inst X":{"Enabled":true,"Hello":-2,"Hi":6}, "My Inst Y":{"Enabled":true,"Hello":-2,"Hi":6}, "My Inst Z":{"Enabled":true,"Hello":-2,"Hi":6}, "My Other Instrument":{"Enabled":true,"Something Else":true} } I mention this as I have noticed that LabVIEW programmers often get stuck in a mental model of JSON Objects and Arrays mapping onto LabVIEW Clusters and Arrays. In particular note that JSON Objects are not fixed type and number or elements at edit time (unlike Clusters), and JSON Arrays are not restricted to all elements having the same type (like LabVIEW Arrays). I also made the last instrument in my example one with a differences in its config structure. By using JSON, you can still let your User change common settings (like "Enable") even with instruments that cannot be represented as the same LabVIEW Cluster. This is an example of "Duck Typing", which can be difficult to do in LabVIEW otherwise.
  12. You should be using $[*] or $[0] to indicate Array elements; $.[*] indicates all items in a JSON Object and $.[0] is the Object item named "0". Look at the detailed Help page for JSON Path notation in JSONtext.
  13. Two suggestions: 1) Consider using JSON as your config-data format, rather than clusters. Using JSONtext to manipulate JSON will be faster than using OpenG tools to manipulate clusters. 2) Programmatically get an array of references to all your config-window controls and register a single Event case for Value Change of any one of them. Then use their (hidden) labels to encode what config item they set. For example, your control with the caption "Baud Rate" could have the hidden label "$.Serial Settings.Baud Rate" which is the JSONpath to set in your config JSON (or config clusters).
  14. Tried it on LabVIEW 2021sp1, and it seems to have at least fixed the problem with a broken VI requiring manual recompile. No working VI with apparently broken wires yet, either. Possibly I should just up the base version of this package to 2021.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.