cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Did you get called away in the middle of writing a post? Don't worry you can find your unfinished post later in the Drafts section of your profile page. X

How to implement a multiple selection in the control option (such as radio buttons)

yhuang-3
1-Visitor

How to implement a multiple selection in the control option (such as radio buttons)

Hi All, I was trying to build a radio button list, with 5 options. How can I implement the multiple selection from the list? Thank you!

multiple selection.JPG

ACCEPTED SOLUTION

Accepted Solutions
RichardJ
19-Tanzanite
(To:yhuang-3)

Mathcad radio buttons do not allow multiple selection. Neither does the listbox. There is a listbox here: Extra Components and Controls that does allow multi selection (a little more than half way down the worksheet). Note that some of the controls do not work in Windows 8 or later. At some point I'll try to find time to fix them (or delete them).

View solution in original post

13 REPLIES 13
RichardJ
19-Tanzanite
(To:yhuang-3)

Mathcad radio buttons do not allow multiple selection. Neither does the listbox. There is a listbox here: Extra Components and Controls that does allow multi selection (a little more than half way down the worksheet). Note that some of the controls do not work in Windows 8 or later. At some point I'll try to find time to fix them (or delete them).

Hi Richard, would you tell me which one should I use in the worksheet you provided? I am using Mathcad 15 but most of the functions cannot run in Windows 8. Would you tell me the specific one I am looking for, so I can try it separately? Thank you!

Werner_E
25-Diamond I
(To:yhuang-3)

I guess its this one:

RichardJ
19-Tanzanite
(To:Werner_E)

That's the one

Thank you Werner, I have the last question about this selection. In the worksheet you provided, we can have more than one selections. However, if I have to limit the maximum selection to up to 2, how can I do it in this example? This means users can select only one, or select any two of them. But they cannot select 3 of them. Thank you!

RichardJ
19-Tanzanite
(To:yhuang-3)

The short answer is that you need to change the script in the listbox.

The long answer is that I wrote that script a long time ago, and making it do what you want will require some work. I am leaving for a conference first thing tomorrow morning, and I doubt I will have time to work on it until I return, more than a week from now. Maybe someone else can make the necessary changes. If not, I'll try to find time when I return.

Thank you, Richard! I will try to modify it myself first. If I still have the problem in getting it, will let you know and wait for the answer from you or anyone else in the forum.

HiWerner, would you advise me how to do the post process to the calculated selection matrix? In your example, the first, second the fifth logic number is "1". How can I convert this condition to an indicator to proceed my next calculation?

What I want is similar to the "value" shown in the radio button setup. In the following snapshot, the values can be used directly. How can we achieve the similar goal in this case?

post process the selection.png

Werner_E
25-Diamond I
(To:yhuang-3)

There are a number of possibilities;

1) Modify the script to return the wished for values rather than 0 and 1. You may consider adding an additional input vector with the values to the component and you may modify the script to return just a vector with valid values, no zeros.

2) You could multiply (vectorized) the vector consisting of 0s and 1s with a vector of values to get your result vector. It will have a 0 where nothing is selected and the wished values otherwise. You could filter the zeros to trim the vector.

3) Use match and trim like I had shown in my post (below) from

Werner

Hi.

Richard's components and controls are excellent, and much better than mathcad ones.

But for multiple choice selection native from mathcad, you have the "List Box" under controls menu.

Best regards.

Alvaro.

listbox.gif

RichardJ
19-Tanzanite
(To:AlvaroDíaz)

What is being asked for is a control that allows more than one selection at the same time, for example "One" and "Two". The Mathcad listbox cannot do that.

Oh, yes. Don't see that. Thanks.

Best regards.

Alvaro.

Werner_E
25-Diamond I
(To:yhuang-3)

You may simulate that multiple choice using a couple of check boxes

but its a bit cumbersome:

So Richards component sure is a more elegant solution, but as its not a web control, you will get that warning when your sheet is opened.

Werner

Announcements

Top Tags