12-25-2019 06:15 AM
Dear RavensFan, Thank you so much, It has been really helpful and I am trying to implement the same based on your expert advice. I am facing issues with unbundling the string. Herewith, I attach my vi here. I kindly request you to assist me with unbundling. Thank you, once again.
12-25-2019 09:54 AM
You forgot to wire the datatype into the top of the unbundle at the terminal called "Type". That is how LabVIEW knows how to take the string of bytes and what type of data to turn it into.
So take the wire that is running into the Flatten to String in the top loop, Right Click and Create Constant. Drag that constant to the bottom loop and wire into the top of the Unflatten function.
Ideally, you make that constant a TypeDef control. That way if you ever need to change the data type, (add another piece of data, remove one, add an enum, ...) you just change it in the typedef control and your code will update everywhere.
My general rule is that I make a TypeDef out of every Enum and Cluster I create.
12-25-2019 10:33 AM
Thank you, dear RavensFan. I was successfully able to wire and myself getting aware of the concepts. Thank you so much. While I try to run the vi I get this following error.
Herewith, I attach the vi. I kindly request your expert guidance.
12-25-2019 11:52 AM
You did not create the constant from the wire in the upper loop.
Hover over the wire in the upper loop with Context Help turned on. Notice the data structure.
Hover over the constant in the lower loop with Context Help. Notice the data structure is different. You created that constant on your own and got the order of elements swapped.
Either:
1. Edit the order of the elements in the lower constant to match the upper loop.
2. Delete that constant and create it like I said by right clicking and pick Create Constant from the cluster wire in the upper loop.
And.
Either way, create a typedef out of that cluster and use the typedef in both places.
12-25-2019 10:09 PM
Whoa! Dear RavensFan, this has been a worthwhile learning experience for me. I just followed your advice and fixed the issue. I am really much grateful for you. Thank you so much.
@RavensFan wrote:
Either way, create a typedef out of that cluster and use the typedef in both places.
I am unaware of how this (typedef out of a cluster) could be done. I kindly request you to throw light upon this. Thank you in advance.
12-26-2019 11:50 AM
Right click on the constant and pick Make Type Def. Save the resulting control file. This only works in the few most recent versions of LabVIEW.
https://zone.ni.com/reference/en-XX/help/371361R-01/lvhowto/creating_type_defs/
For older versions, there is a slightly different method that it is a couple more steps. Let me know if your version is older than LV2015.
12-26-2019 11:16 PM
Really so kind of you. Thank you so much dear RavensFan.