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

Community Tip - Learn all about the Community Ranking System, a fun gamification element of the PTC Community. X

Attribute an Inputbox value to a listbox output

Matthurin-disab
1-Newbie

Attribute an Inputbox value to a listbox output

Hello,

I met some problems while scripting a listbox. Indeed, I have a listbox in which I want an output to be equal to the value I enter in an inputbox.
I succeeded to have the Inputbox appearing as I wanted, but the value of the output stays 0. I tried in different way to attribute the value entered in the inputbox to the output, without success. I guess it's probably due to one missing script code, but I don't really know all of them...
Thanks for your time,

Matthurin.

7 REPLIES 7

here is the file in Mathcad 11 format...

On 2/25/2009 9:40:59 AM, Matthurin wrote:
>here is the file in Mathcad 11
>format...
_______________________________

linterp(X,Y,x)
"Returns a linearly interpolated value at x for data vectors vx and vy of the same size. The elements of vx should be in ascending order".


You have no data set, therefore linterp does not apply. As it seems the components has the slope and intercept, you just need to to define the linear function :
f(x):= b+a*x
"Other" wants something !

jmG



Well thanks for this fast answer, but actually a & b are independent here.Their values are empirically determined ( overtopping of breakwaters) and used separately in another formula later on. As experiments have just been made for the slopes entered in the listbox, standards recommend to interpolate values of a & b regarding on one hand the slopes and the "a" values, and on the other hand the slopes and the "b" values, which is working here.
What I'd like to have, is, when "other" is selected, to have no values for "a" and "b" (0 or N/A), and an inputbox appearing, for which the value entered will be equal to a 3rd listbox output.
I don't know if I make myself really clear but this worksheet might help...

Thanks again,

Matthurin.

>I don't know if I make myself really clear but this worksheet might help...<<br> ____________________________

Not clear by just reading !
There is an error in the component, all red. I don't use those gadgets, hey carry viruses. They are some convenience mostly within Mathcad. If they wouldn't exist all my work sheets will be fine except for some very useful from Richard and Xavier. It would make easier if you had done the project w/o and then collab try to install the scripted components. Often, the preferred way to go is simple and modular, then visible and traceable.
Can't help on that one .

jmG

InputBox is a function. As such it requires parentheses around the arguments, and it returns a value. It's not an object, and therefore does not have properties. What it returns is a string, so you also need the CDbl function to convert that to a floating point number.

Richard

Thank you very much!
I was starting to wonder if this was possible to do or not, now I can keep going!
Thanks again!
Matthurin.

It works fine for me.

Richard
Top Tags