| Make range input for an object [message #76] |
Thu, 12 April 2007 15:12  |
tverwoest Messages: 6 Registered: August 2005 |
Junior Member |
|
|
Assume the object function:
D(@a,@input:From$ + "(" + Step$ + ")" + To$)
D is a function that creates "a" (indicated by @a) on the basis of "input";
From$ is the lower bound of the input;
Step$ is the step size;
To$ is the upper bound;
in this relation From$ + "(" + Step$ + ")" + To$ is a nice trick to create a range as input for an object.
Please note that normally you only can provide a range for parameters after you have created a model (the process of request for choices and input). In the above approach you are actually able to create the range for the object during the creation of the model (the reasoning).
In Quaestor range can be defined like:
- From 1 to 10.5 with a step size of 1: 1(1)10.5
- From 1 to 10.5 in 10 intervals: 1(&10)10.5
- From 1 to 10.5 in step size of 1, including the last element when this is smaller than the whole amount of steps: 1(#1)10.5
|
|
|
| Re: Make range input for an object [message #83 is a reply to message #76 ] |
Fri, 20 July 2007 13:23   |
Qnowledge Messages: 57 Registered: August 2005 Location: Netherlands |
Member |
|
|
Instead of using From$, StepSize$ and To$, which are string parameter, it is better to use value parameters combined with the STR$() function:
D(@a,@input:STR$(From) + "(" + STR$(Step) + ")" + STR$(To))
Most important reason is that by using values you will be able to set for instance minimum and maximum values etc.
We added a simple knowledge base as an example...
[Updated on: Fri, 20 July 2007 13:27]
|
|
|
| Re: Make range input for an object [message #91 is a reply to message #83 ] |
Tue, 13 November 2007 19:48  |
Qnowledge Messages: 57 Registered: August 2005 Location: Netherlands |
Member |
|
|
The example now includes all range types.
Good luck,
|
|
|