05-30-2012 07:17 AM
@Grant_C wrote:
@Ben. Hi Ben, i believe what i am trying to do with my 200 references of clusters is similar to a thread you were involved in some time ago: here. Can you shed any light on the Xcontrol your rookie developed?
Regards,
Not without giving away a trade secret.
WHat I can do is invite you to chase down the posts where I posted about a GUI Controller.
1) Fist, here is a link to an albumn that has images I have posted to support the topci of a GUI Controller.
2) Click on each of those images to get a bigger image.
3) SCROLL DOWN below the image and you should find links to the original threads where I talked about the code.
Read what I have posted already.
But generally speaking...
We have been responding to your specific question as best we can but I wonder if you are using the best approach for this task.
Yes I have written apps that have as many as 500 FP objects but they were not being used as data storage just for display and user interaction.
I suspect your code shoould be developing a cluster ON THE BLOCK DIAGRAM that can be passed to the sub-VI to gen the report.
So while I am trying to answer your question I want to turn it around and ask if you have concidered just packing up the data in a cluster that can be passed to the sub-VI rather than trying to "reach out" from the sub-VI to get the data?
Take care,
Ben
05-30-2012 07:55 AM
Hi Ben, thanks for those images. I see in image "1_Bundle_Refs.PNG" that you use a method that I have been using in my subvi's that make up my front panel. Here you are using references feeding into a bundle and using their respective constants to create a single constant. Is this methods OK as this is what I am intending on using but I am a bit suspicious from feedback left in this thread. Due to the amount of references I will have(200), it will take up a lot of BD space so that is why I posted this suggestion of using a case structure. The outcome of the case structure would be the same with 1 cluster of references that I could feed into my subvi. Earlier I posted an example of my intentions with an example using 4 references and a case structure but I would in fact have 200 cases. Do you think this would be suitable as I don't see much difference.
05-30-2012 07:59 AM
link to "1_Bundle_Refs.PNG" here
05-30-2012 08:27 AM
If it's a report of 200 clusters, is it some test protocol? If so, itsn't it an array of the same clusters, or could be? If so, send the array and generate the report from that. 🙂
/Y
05-30-2012 09:58 AM
I have not seen your specific application but I still believe you are going about things in the wrong manner. Are you saying taht a single record (row) in your report contains 200 pieces of data? Unless they are simply an array of data it sounds like you are not decomposing you data and functionality enough. I know you have not stated that you are using a database but you would be hard pressed to find a well designed database that had tables with 200+ columns in it. Also, if you are passing the data to a report generator it is best to pass the data, not references to it. As I mentioned earlier you don't want to tightly couple your processing code (report generation) with your GUI. Passing references does just that. Ben pointed you to his thread about separating your GUI from your processing. Your application will be much harder to maintain if you lower level code reachs out to the GUI for data.
05-31-2012 01:20 AM
Hi Mark, thanks for your response. My Word and Excel reports will use these 200 reference clusters (results in the form of indicators, graphs and tables along with the tab controls for screenshots) to generate the reports. I don't have a single record as you call it.
When you say its best to pass data to my subvi instead of references like I intend in the form of a single cluster of references, how would you go about getting 200 clusters into the subvi. A cluster of clusters? That would mean all my code that I have so far written would change. (not a problem if its the correct method). At present my flat sequence code is using references into my subvi's to populate my front panel - see my attached vi which shows my front panel and all the indicators that are currently referenced.
Regards,
05-31-2012 03:42 AM
200 reference clusters? Sounds like 1 array of ref to me. 🙂
/Y
05-31-2012 09:05 AM
Since you are open to improving your code I suggest you shift focus from try to get ath the FP controls using references and use a cluster to store the DATA you will need in your report.
This image shows a sub-VI where a cluster is passed in, a new value is added to an array and then packed back into the cluster.
Accessing the data using acluster is much faster than getting a control or indicator involved and will also work toward reducing the potential of Race Conditions.
SO I would envistion you code as passing the cluster from state to state filling in the parts and when ready to report, pass the cluster to the function that will write the report.
Ben
Ben
05-31-2012 09:12 AM
Hi Ben, Thanks for your recent suggestion however through discussion with NI, I have decided upon my best way forward for now. I am sticking with bundling up my references into a single cluster (using my aforementioned techinique using the case structure to reduce the size on my BD) due to the fact that i need to programaticaly change my tab controls to select which page is visible prior to me taking a screenshot and pasting this in Word.
Thanks ALL for you help. I have picked up some great tips through this thread.
Grant