LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

To more specific class works on IDE but not on EXE, on target machine


@SPRD wrote:

Hi Jay,

thanks for Your feedback, but the point is that ini file is correctly read, not all of the data are correctly displayed as this refnum is not handled properly by the exe, while in the development evironment everything works well.


Silvio, can you please "strip down" your project just up to few "minimal" SubVIs with few controls, where this problem is reproducible and share project here as source code as attachment?

0 Kudos
Message 11 of 21
(248 Views)

@SPRD wrote:

Hi Jay,

thanks for Your feedback, but the point is that ini file is correctly read, not all of the data are correctly displayed as this refnum is not handled properly by the exe, while in the development evironment everything works well.

I previously indexed directly the array of refnums, with a lastvalue + conditional behavior to have the needed refnum referring to the controls where I need to show the data.

With the problems I found, I changed the parsing VI as I read that this approach can give problems.

I get refnum without errors out of the parser, but when i fetch it to a "To a more specific class" VI, than rises the 1057 error.

On development environment I see that the ControlRef is referring to the correct control, so I do not unerstand why I get the error.

Silvio 


Yes, you are getting the 1057 error because;

  • the string array is empty 
  • Therefore the for loop iterates 0 times
  • Therefore the error out of the loop is default value because you didn't put the Error wire on a SR.
  • AND The default I32 will be 0
  • THEREFORE the index of refnum returns a refnum to a listbox control 
  • Therefore you get the error 1057 because a listbox cannot be cast to a ring

Do what I said before.

 

Then we can try to figure out why the string array is empty (probably a rel path changes in the exe causing an error 7 that you lose in the following 0 iteration For Loop! BECAUSE you didn't put the Error wire on a SR)

 

You really want to return "Not a Refnum" if the string array is empty or the control Label is not found!!! As it is you will return refnum index 0 in either of those cases!  And that refnum is to a listbox control type! Hence, error 1057 from the "To More Specific [Ring]"

 

Note: do not simply replace your loop with the search array primitive!  A NULL string matches everything and you'll just exchange bugs.

 

Lastly,  thanks are kudos.   Just click the yellow star  

"Thanks but," generally means that we failed to communicate.   So let me be clear... Your Get Refnum from Name.vi is f'd^! Fix it!


"Should be" isn't "Is" -Jay
Message 12 of 21
(241 Views)



@SPRD wrote:

Dear UliB,

 

Probe 34: if I run the program on development machine, the result si as for below image

Probes Values DevMachine ReadCMDiniFile.png

Thnks

 


... and what is the probe value in the executable? It does not help to check the value in the working development environment.

Jay already pointed out that there is a possibility that error 1057 is a only symptom and happens because there went something wrong before.

Message 13 of 21
(208 Views)

Dear Jay, UliB, Andrey,

about the Kudos, I am new to this platform, so I was unaware about conventions.

Regarding the suggestion form Jay, please confirm me that You were suggesting the following IV configuration.

FindControlFromLabel3.png

With the suggestions I received, I verified the VI that generates the two arrays (Controls Labels and Refnums) and found that when the application was run on the development platform I had 83 control reference, while if run from as EXE, the arrays were both of 50 references.

I modified the VI and the way I pass the main's VI reference to obtain the two arrays, opening the VI reference from the main VI and not inside the subVI.

CreazioneReferences.png

 

 

 

0 Kudos
Message 14 of 21
(184 Views)

@SPRD wrote:

Dear Jay, UliB, Andrey,

Regarding the suggestion form Jay, please confirm me that You were suggesting the following IV configuration.

FindControlFromLabel3.png

 


Not fully correct. If you have no error and no equal condition the while loop will never stop.

Replace the while loop with a for loop (which can have a conditional terminal too). Now the autoindexing input tunnel will also limit the loop count.

 

 

Message 15 of 21
(173 Views)

I re-read Jays suggestion and now I would go with something like that

 

find ctrl from label.png

 

Edit: No need for the error wire in the loop and if no label matches return 'not a reference'.

Message 16 of 21
(163 Views)

@SPRD wrote:

Dear Jay, UliB, Andrey,

about the Kudos, I am new to this platform, so I was unaware about conventions.

 

 

Regarding the suggestion form Jay, please confirm 

 


See the excellent for loop UIB implemented. 


"Should be" isn't "Is" -Jay
Message 17 of 21
(128 Views)

@UliB wrote:

I re-read Jays suggestion and now I would go with something like that

 

find ctrl from label.png

 

Edit: No need for the error wire in the loop and if no label matches return 'not a reference'.


Excellent!  Extra kudos in tag. Although, I would rearrange the diagram so that the terminals match the connector pane.  That's just a style practice.

 

EDIT: Bonus, the loop is "Parallelizible"  so right-click the loop and chose the Enable Parallel loop option to speed it up if the arrays are large.  (We really have a case where the TRUE condition is sparse 0 or 1 instances of all)  you could even inline that vi.


"Should be" isn't "Is" -Jay
Message 18 of 21
(125 Views)

@JÞB wrote:

@UliB wrote:

I re-read Jays suggestion and now I would go with something like that

 

find ctrl from label.png

 

Edit: No need for the error wire in the loop and if no label matches return 'not a reference'.


Excellent!  Extra kudos in tag. Although, I would rearrange the diagram so that the terminals match the connector pane.  That's just a style practice.


My snipped does not have a connector pane 😉 , but when I look at the VI connector pane from OP I think the terminals match the connector pane perfectly.

Find Ctrl FromLabel Connector Pane.PNG

 

Edit: If you talk about front panel controls and indicators I would go with this

Find Ctrl from label_FP.png

Message 19 of 21
(116 Views)

@UliB wrote:

@JÞB wrote:

@UliB wrote:

I re-read Jays suggestion and now I would go with something like that

 

find ctrl from label.png

 

Edit: No need for the error wire in the loop and if no label matches return 'not a reference'.


Excellent!  Extra kudos in tag. Although, I would rearrange the diagram so that the terminals match the connector pane.  That's just a style practice.


My snipped does not have a connector pane 😉 , but when I look at the VI connector pane from OP I think the terminals match the connector pane perfectly.

Find Ctrl FromLabel Connector Pane.PNG

 

 


Fair enough,  those wires should have been uncrowded by rearranging the cluster order!  

 

As long as the subvi above has error in, USE IT so not a refnum is returned on error OR no match.


"Should be" isn't "Is" -Jay
Message 20 of 21
(102 Views)