LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

HTTP Get with multiple data elements

Solved!
Go to solution

Greetings,

 

Would love some help with this setup I'm working on but first let me give some context:

 

So, I have a project I'm working on where some sensors involved in the main setup measure and send their data to a URL and the goal is to take this data from the URL and represent it graphically in LabVIEW. Because of this, I'm trying to implement a simpler system first in order to understand the processes a bit better; as well as developing it as a little personal project simultaneously.

 

The current setup I'm working with uses an app on my iphone which generates data using the phones sensors (Phyphox). Phyphox sends this data to the URL from the phone. This data is displayed on three different graphs and this is all that's shown on the URL. This URL info is reduced to only retrieving the raw data in JSON format of what's being displayed on the graphs. This is the data I would like to manipulate in LabVIEW (specifically, I'm just using the accelerometer to trigger a counter in LabVIEW).

 

I've followed a few tutorials and tried setting it up and I get the raw data (headers & body) from the URL into LabVIEW but I can't get the data to display in the Front Panel cluster or have any idea how to display it on a waveform chart. I have another project with some graphs I can use as a reference to build up on and represent the data nicely but haven't done so because I can't get the data to flow into the cluster displays. There are two clusters (status cluster & buffer cluster) and the status cluster deals with actions involved in the measuring process while the buffer cluster deals with the types of data coming from each graph. The rest of the setup is done mainly using an example and manuals.

 

In summary: Data from phone to URL, URL to LabVIEW, URL data should be registered in LabVIEW front panel cluster, display data graphically and generate a counter for the incoming data. The issue occurs at the value wire from Unflatten from JSON to Value Cluster. 

 

I have included 3 versions just in case, 25.0, 17.0, 10.0.

 

Let me know if I'm missing anything and thank you in advance!

0 Kudos
Message 1 of 7
(183 Views)

Hi PDB,

 

unfortunately you forgot to provide some useful default data in your controls&indicators!

 

How should we help in analyzing JSON data when we don't know how they look like?

 

(In the end JSON is just a simple string and there is a palette full of string functions…)

 

Generic advice:

Use typedefinitions for all clusters!

The cluster definition for the JSON parsing is not the same as the cluster indicators on your front panel! (It's not just about the data contained, but also in the order of cluster elements…)

 

Do you spot the differences?

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 7
(173 Views)

Hey,

 

Thanks for the swiftness.

 

Please clarify. Not sure if you're referring to an actual screencap of the data from the URL but I'll include it here regardless.

 

PDBSteenhuisen_0-1758023939465.png

 

Edit: Nevermind, responded before your edit. Let me check 

 

 

0 Kudos
Message 3 of 7
(152 Views)

Hi PDB,

 


@PDBSteenhuisen wrote:

Not sure if you're referring to an actual screencap of the data from the URL but I'll include it here regardless.


Did you know we cannot edit/run/debug images in LabVIEW?

Do you want us to type all that text from your image?

 

I explicitely wrote about "default data in controls and indicators"…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 4 of 7
(140 Views)

Hey again Gerd,

 

I can definitely spot the differences. Still not sure how to implement the changes though. Please elaborate a little more.

 

Thanks for the info.

0 Kudos
Message 5 of 7
(123 Views)
Solution
Accepted by topic author PDBSteenhuisen

Hi PDB,

 


@PDBSteenhuisen wrote:

I can definitely spot the differences. Still not sure how to implement the changes though.

Please elaborate a little more.


As I wrote before: it's about the order of cluster elements.

 

Several options:

  • So you need to re-order the cluster elements in your indicators to fit with your cluster constant.
  • As I wrote before: use typedefinitions for all clusters! Then there will be only one place to define the cluster instead of multiple instances in your small VI…
  • Delete those cluster indicators. Then you can just right-click the outputs of the Unbundle node after UnflattenFromJSON and create->indicator…

(All 3 options apply basic LabVIEW knowledge: I recommend to (re)evaluate those training resources offered in the header of the LabVIEW board.)

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 6 of 7
(107 Views)

Hi again GerdW,

 

Thank you so much for the help! I previously tried switching them around and tried some other things but it simply wouldn't work. Pretty funny, and now very obvious, to see it was just one of the most basic features that gave me the solution (specifically just creating the indicators at the output of the Unbundle node was the ultimate quick fix). Most of these basic features tend to slip by me though so thanks a lot.

 

Best regards,

PDB

0 Kudos
Message 7 of 7
(49 Views)