Skip to main content
15-Moonstone
March 1, 2021
Solved

how to use controls to switch inputs

  • March 1, 2021
  • 1 reply
  • 4627 views

hi,

 

i'm sure this is an easy question for a lot of you. i don't understand the help or built in examples for this topic. i have a variable i want to switch using some type of control. i can't figure out how to do it. i got the slider switch working, which is nice. but the other controls i can't figure out. i attached the matchad 15 worksheet. not interested in a prime solution, if there is one.

 

there are five choices for the variable z. i have just been manually typing in the choices. if you could show how this would work for as many of the controls as possible, i would appreciate it. it's something i'd like to learn how to do.

 

thanks

Best answer by Werner_E

In the attached file you find two ways for the selection of "z".

The first one uses the text box from the Web Controls. They are easy to use, won't trigger the popup window when you open the sheet (because Web Controls don't allow for scripting) but are rather inflexible. You have to manually hardcode the names you want to see in the list box and also the values they should return. I had chosen to return values from 0 to 4 which then are used as an index in a nested vector consisting of your choices.

 

The second approach uses a scripted textbox and i modified one found in the collection of RichardJ. It uses two input lists (one with the names to be displayed and one with the values z should take).

If you are interested in scripted components, you sure should have a look at Richards collection here: https://community.ptc.com/t5/PTC-Mathcad/Extra-Components-and-Controls/m-p/450450

 

 

1 reply

Werner_E25-Diamond IAnswer
25-Diamond I
March 1, 2021

In the attached file you find two ways for the selection of "z".

The first one uses the text box from the Web Controls. They are easy to use, won't trigger the popup window when you open the sheet (because Web Controls don't allow for scripting) but are rather inflexible. You have to manually hardcode the names you want to see in the list box and also the values they should return. I had chosen to return values from 0 to 4 which then are used as an index in a nested vector consisting of your choices.

 

The second approach uses a scripted textbox and i modified one found in the collection of RichardJ. It uses two input lists (one with the names to be displayed and one with the values z should take).

If you are interested in scripted components, you sure should have a look at Richards collection here: https://community.ptc.com/t5/PTC-Mathcad/Extra-Components-and-Controls/m-p/450450

 

 

15-Moonstone
March 2, 2021

thanks werner,

 

the web control is nice. i switched the slider to a list, using your example. i never would have figured that out. thanks a lot.

 

anthony

15-Moonstone
March 2, 2021

i attached an update with more of the quick sheet info i used for the analysis. i can tell visually that a different approach, that i have been using, is better. however, i have a dumb math question, for the approach in the mathcad file. with 2d spreadsheet curve fits, there is the r^2 value you can use to mathematically judge the fit. with the 3d poly curve fits, is there an equivalent? i didn't see anything in the help. i imagine there must be something, but it doesn't seem to be mentioned in the help files. the hidden area has the math, which i stole from the help quick sheet. i have the web control from werner in there as well.