LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to interactively create input fields according to value from another input field

Hello,

Im doing a LabView project designed to control an XY stage.

I am somewhata intermediate in LabView, having only done a short basic course in school.

Before trying to dive in, i decided and simulate the action with a language i am more familiar with - python - to ease the logic and structure of the code in my mind.

I already finished the simulation and the first problem unveiled:

 

Is there a way to interactively create input fields according to input received from another field?

 

I want the user to insert the number of desired segments. Each segment has 4 unique parameters - X distance, Y distance, velocity, repetition count.

So if for example the user insert 5 in the segment field id like to display 5 rows with 4 numeric input fields each.

 

Another option that may work for me is to pre create a maximum of 10 rows, and after the user input the segment number (up to 10), say 3, 3 rows will be visible and accessable for input.

 

Any advices on how to do it?

I already searched the internet and this community specifically and saved some posts that might help, but none of them solved my question.

 

Thanks in advance for helping

0 Kudos
Message 1 of 16
(1,805 Views)

Hi Aqua,

 

I prefer to use a (multicolumn) listbox to present the "steps". The user can select rows to edit them. Then I place additional controls next to the listbox so the user can input your parameters. Then you need two buttons to add new rows or delete the selected one...

Best regards,
GerdW


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

My first thought was to use an array of cluster (containing four numeric controls) and change the NumRows property:

 

clusterarray.png 

jcarmody_0-1598290222362.png

 

Jim
You're entirely bonkers. But I'll tell you a secret. All the best people are. ~ Alice
For he does not know what will happen; So who can tell him when it will occur? Eccl. 8:7

0 Kudos
Message 3 of 16
(1,789 Views)

Awsome!

this is more the way i imagine it graphically and in terms of what i want to allow my user to input.

I am not familiar with complex usage of this dataset. is it possible to use each array (row) seperatly for actions and events?

In short, each segment is represented by an array and i would like the stage to move according to the parameters of the first row, when it finished it should continue to the second and so on, so the user could create different (and somewhat simple) shapes as rectangle, triangle, grid, and other stright line shapes...

 

If i enjoy the making enough i'd go for a circle which i suspect will be harder task with a need to define polar cordinates somehow within the program, but that is still early 😁

0 Kudos
Message 4 of 16
(1,759 Views)

@Aqua- wrote:

Awsome!

this is more the way i imagine it graphically and in terms of what i want to allow my user to input.

I am not familiar with complex usage of this dataset. is it possible to use each array (row) seperatly for actions and events?

In short, each segment is represented by an array and i would like the stage to move according to the parameters of the first row, when it finished it should continue to the second and so on, so the user could create different (and somewhat simple) shapes as rectangle, triangle, grid, and other stright line shapes...

 

If i enjoy the making enough i'd go for a circle which i suspect will be harder task with a need to define polar cordinates somehow within the program, but that is still early 😁


Make a For Loop that iterates over the array of parameter sets (wire the array into the For Loop to iterate over that array). Inside the loop is where you tell the stage to move based on the parameters for the given iteration. When iteration 0 is done, it will move to iteration 1 and so on.

Redhawk
Test Engineer at Moog Inc.

Saying "Thanks that fixed it" or "Thanks that answers my question" and not giving a Kudo or Marked Solution, is like telling your waiter they did a great job and not leaving a tip. Please, tip your waiters.

0 Kudos
Message 5 of 16
(1,756 Views)

Hello and thanks again for your help.

I worked all morning and have made some progress.

So what i have done is dropping an array and placing a cluster inside. inside the cluster i placed 4 numerric fields and chose their type of data.

I also wired the array to the for loop as you mentioned, now I tried to think about the group Name (second input field in the XPS inside the loop) - the group name given by the manufacturer is some long name e.g. XRO34PL9. is there a way to give a numeric field a key name, but still present the label i desire, so i can wire the key element of the field to the group name and use its value all at once?

It is not that crucial cause i can always uses a constant string (as shown in the picture), but it seems like better programing to do it that way...

 

Another problem i encountered is the fact that i need to specify which direction should be invoked first - X or Y.

I decided t start trying create a grid, so I copied the UI and seperated it into vertical segments and horizontal segments.

I limited the vertical movement (i.e. Y>X distance) to go first, and so Y direction move first, then X. When all vertical segments finish, the horizontal loop should start.

By wireing the invoke nodes as i did, i hope the order of the invoke will go as i desire, i.e. in the vertical loop Y then X, and in the horizontal X then Y.

Is that make sense? I start to realize the course did not prepare me that well for this kind of project...

Also i looked over in my machine's programmer manual, a technical note that explains how to start a .NET node + looked over the internet for what should be the input in nbitem row in the XPS inside the loop, but couldnt find anything. any idea? it is an int32 type.

Moreover the TargetDisplacment row recieves an array, but it doesnt make sense, as the internet page made by the company to control the stage allow to insert a float/double to the rel distance field and it makes a move of the inserted distance in relative to its last stop.

 

Thanks tons for helping.

Screenshot from 2020-08-25 15-44-55.png

Screenshot from 2020-08-25 15-44-20.png

0 Kudos
Message 6 of 16
(1,711 Views)

Hi Aqua,

 


@Aqua- wrote:

Is that make sense? I start to realize the course did not prepare me that well for this kind of project... 


Ask yourself: does it make sense to create a 2D array of the very same "XPS" reference between your 2 loops?

Your course should have taught you the basics about the different type of loop tunnels…

Best regards,
GerdW


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

@Aqua- wrote:

is there a way to give a numeric field a key name, but still present the label i desire


You can have a caption that gets displayed while the actual label can be hidden and changed to whatever. As an example, make some numeric control on your front panel. Right click > Visible Items > uncheck Label. Right click > Visible Items > check Caption. Change caption to some name to be displayed, the label will stay the default name.

Redhawk
Test Engineer at Moog Inc.

Saying "Thanks that fixed it" or "Thanks that answers my question" and not giving a Kudo or Marked Solution, is like telling your waiter they did a great job and not leaving a tip. Please, tip your waiters.

0 Kudos
Message 8 of 16
(1,699 Views)

awsome got it!

 

Another question about the array of clusters which i use for collecting input:

I have tested my code in the following way:

i chose move in 3 segments with my stage, meaning i changed the numeric field connected to the number of rows to 3.

3 rows appeared to me in the array of cluster. i inserted the parameters, pressed start and the stage moved.

after that i chaged the number of segments to 1, hence the array of clusters reduced to 1 row of parameters, i changed the values and hit start.

to my surprise the stage moved first according to the new parametes i inserted, but then went on to move according to rows 2 and 3 in my previous check.

Is there a way to auto clear all the rows that are not presented? or maybe, instead, save the previous data in the UI, but using the data only of the rows being shown ?

0 Kudos
Message 9 of 16
(1,665 Views)

Hi Aqua,

 

see the reply you got in your other thread

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 10 of 16
(1,661 Views)