Jump to content


  • Posts

  • Joined

  • Last visited

  • Days Won


Everything posted by drjdpowell

  1. 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
  2. Good luck AQ, Hope your new employer still lets you attend a conference or two in Europe.
  3. Ah, it's because I added submenus in last release, and this added '_1' onto teh menu name. I'll fix that.
  4. 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.
  5. 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).
  6. 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.
  7. 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.
  8. 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.
  9. 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).
  10. 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.
  11. Thanks. I see there is also this one that may be the problem I'm having: 1513139 Malleable VIs Are Sometimes Erroneously Broken When Operating on Cluster Data Value References
  12. Put a new 0.5 version on VIPM.io Remember, this is still beta code.
  13. @AQ, I've incorporated most of your improvements, and made some changes myself. Question, though. These VIMs seem plagued by (in LabVIEW 2020) strange recompile bugs: broken wires that are usually fixed by doing a manual force recompile on the VI. Though often this still leaves some broken wires in a runable VI?!? See image. What do you think causes this and is there a way I can avoid it?
  14. Did you add "file:" to the front to make a URI path. And what do you mean by "does not work"? What are you expecting shared-cache mode to do exactly? Shared Cache has nothing to do with multiple computers accessing a db (and yes, that is something you would be better off using Postgres).
  15. I have never tried shard cache mode. Are you sure you actually need it? If so, try using a URI path to set it following this: https://www.sqlite.org/c3ref/open.html#urifilenameexamples
  16. On the off chance anyone does use this, I have a beta with improvements: https://forums.ni.com/t5/JDP-Science-Tools/Beta-of-Cyth-SQLite-Logger-1-7-2/m-p/4208206 Biggest improvement might be a highlighting mode, as an alternative to the usual filtering, so entries matching the pattern show up in blue:
  17. My point about Network Streams is not that they aren't a useful set of features for some uses cases, but that building something different, with contrary features, on top of them usually makes no sense. For example, the package hooovahh has posted does (if I read it right) use pinging to check messages are being received, and will close the Network Streams if it doesn't receive a response in about 1 second. This destroys the buffers of any waiting messages and means there is no QoS delivery at all, making all that stuff useless overhead. Not that it matters, because it is also a Request-Reply system where there can only be one active Request, and thus there is nothing to buffer. This makes the "explicit buffer sizing" and "flush method" features entirely meaningless. Network Streams are bringing nothing to teh party here but overhead.
  18. LabVIEW.exe has a public moveblock method that you can call. I find it is better to call it directly than inside those subvis enserge shows.
  19. I have my own package called Messenger Library, which is an alternative to those other frameworks. Within that, my template of a message/event handler is called the DEV Template. There is a video on the DEV on the Wiki.
  20. I have just posted a Beta version of Messenger Library 2.0: https://forums.ni.com/t5/JDP-Science-Tools/Messenger-Library-2-0-Beta-LabVIEW-2019/m-p/4199634#M49 This is in LabVIEW 2019
  21. There are a lot of possible options for encoding Variants, all with a different set of advantages and disadvantages. Without a clear use case, it is difficult to see what the best choice would be.
  22. The Type input just sees "array of clusters". Normally one just inputs an empty array; there is no code to look at individual elements of the array. Theoretically, this could be done, but that seems a very low-value use case so chances of me doing that are zero. Actually, it was a mistake of mine to implement the first part of your code; doing it again I would convert Variants in Clusters to 'null' and throw a "Variants not supported" error. This would keep my options open to introduce, without breaking changes, a better Variant support that includes encoding teh data type (along the lines of what Shaun describes). There is a number of possibilities, for example: { "config file:["c:\temp\config.ini",{"LVtype":"Path"}], "Room Temp":["21.4",{"LVtype":"DBL"}] } I am held back from that, partly because it would now be a breaking change, and partly because I have yet seen an example of someone using Variants and JSON that would not be far better implemented in just JSON.
  23. I believe JKI JSON converts to Variants containing the basic JSON-matching types: String, Boolean, Number (DBL, I'm guessing). Then it also provides, if I remember, a special VI to convert that Variant into your cluster of actual specific data types. One of the reasons I don't like that is that it ties things to a monolithic LabVIEW type, the Cluster, that is not as flexible as JSON Object/Arrays. You show the same "LabVIEW tunnel vision" in your design of an array of "Group", "Name", "Value" clusters. That's a common way to handle the limits of LabVIEW. In JSON, the natural structure is this: { "Basic": { "config file":"c:\\test\\config.ini", "Operator:"Muller" }, "Extended": { "Room Temp":21.4, "Test No":0, "ping":null } } That isn't really doable with your LabVIEW Arrays and Clusters, even if I give you some extra Variant support. But you have tools to do stuff like this in JSONtext.
  24. I would encourage you to try the "subJSON" described in the conversation LogMAN linked to. Basically, replace your "Value" variant with a string labelled "<JSON>Value", and convert your values to JSON (at all the places where you now have "Set Data Name__ogtk.vi"). Then, wherever you are converting your variants to strict type, instead convert the subJSON to that type. The problem with using Variants and JSONtext is that the JSON doesn't contain the specific type information needed to recover the data in the Variant.
  • Create New...

Important Information

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