Community Tip - Learn all about PTC Community Badges. Engage with PTC and see how many you can earn! X

Valid Data in Dropdown List

ppal
17-Peridot

Valid Data in Dropdown List

ppal_1-1721176504638.png

 

Prime 10 attached

 

ACCEPTED SOLUTION

Accepted Solutions
Werner_E
25-Diamond I
(To:ppal)

It doesn't look very nice but you could use a scripted list box with your data vector as its input.

Werner_E_1-1721193572695.png

 

Prime 10 file attached

View solution in original post

10 REPLIES 10
DJNewman
17-Peridot
(To:ppal)

Yeah, you can copy paste your array into a combo box (right side; you don't even need to fill in the left side) and set the definition variable of that to Valid: if you want.

I manage the Creo and PTC Mathcad YouTube channels for PTC, as well as all PTC Mathcad marketing in general.
ppal
17-Peridot
(To:DJNewman)

In the actual sheet  data is not fixed . It will be calculated  and will then have  to make its way into the section box.

Werner_E
25-Diamond I
(To:ppal)

It doesn't look very nice but you could use a scripted list box with your data vector as its input.

Werner_E_1-1721193572695.png

 

Prime 10 file attached

kprice
4-Participant
(To:Werner_E)

I have been trying to do this since 10 was released. Thank you. Works great.

StuartBruff
23-Emerald III
(To:Werner_E)

Just playing and getting used to the new controls ...

 

2024 09 16 A.png

 

Stuart

Werner_E
25-Diamond I
(To:StuartBruff)

Nice 'misuse' of the input placeholder.
Wasn't aware that it would accept a full program.

Noticeable is the different height of the ":=" with respect to the displayed options when we compare choose3 and choose4.

The displacement in choose4 can be avoided by adding a dummy line (Prime would even accept an empty placeholder)

Werner_E_0-1726521897095.png

 

StuartBruff
23-Emerald III
(To:Werner_E)

I was playing around to see if I could use an advanced control on the right-hand side of a function definition.  I failed miserably in that quest see image below. 

 

However, while emulating one of Shakespeare's infinite monkeys (do Goethe or Schiller have their own monkeys?), I did note that a control Input seemed to accept programs.   Indeed, it is possible to define and use local functions within an Input's program.

 

2024 09 17 A.png

 

I could have deleted the assignment to data and just squared fib(5) directly, but I wanted to show that local assignments worked with local functions (I would make a minor joke, here, about local functions for local programs, but I doubt whether many forum users have heard of or seen the British comedy TV show The League of Gentlemen).

 

I'm sure there are several other undiscovered ways to abuse controls. 

 

I also noted some strange behaviour when editing a program in situ. A control would fail with strange error messages, sometimes referring to non-existent script line numbers, such as -299, or suddenly not recognising a standard function name that it was perfectly happy with until the edit.  Copying and pasting the whole region usually cured these ghastly manifestations.

 

Stuart

Werner_E
25-Diamond I
(To:StuartBruff)

I, too, tried to turn a control into a function, but to no avail.

Found a strange effect (nested return matrix) when using a dummy function argument, but can't see any use. The result is independent from the chosen element.

Werner_E_0-1726543899928.png

 

 

StuartBruff
23-Emerald III
(To:Werner_E)

Interesting.  I'd only tried it before with a text box and that returned the value of the text box (IIRC).

 

However, it looks as though using a dummy argument returns the whole of the Input to the control ...

 

2024 09 17 C.png

 

Stuart

Werner_E
25-Diamond I
(To:StuartBruff)

Interesting, so a row vector with all inputs seems to be the 'evaluation' of a component (works even with symbolic eval).

My attempt to evaluate a component directly failed, While it is possible to delete the assignment operator := at the front (makes sense for buttons), it not possible to add an evaluation = at the end.
the eval value of a components are its inputs at least if the are any inputs. If you hoped to get the long asked for empty array when evaluating a component without any input you will be disappointed as the the output value is also the evaluation value in such case.

Werner_E_0-1726576779522.png

 

Announcements

Top Tags