on 2016 Feb 26 4:03 PM
Hi,
I have the following statement in a formula:
if not ({pool_bearbeit.typ} in [200,401,409,410,411,413,420,450]
The numbers are processes, constantly added or deprecated.
To make this more manageable and visible, I'd like to be able to dynamically display these numbers in the page header, to confirm to the User what is actually being chosen.
I believe I've seen code where a single value is entered as a parameter, and then passed through to the report, invisible to the User, but the setup eludes me, and I don't know if that can be done for multiple values.
What method can I use to do this? I imagine it's possible, but the syntax eludes me.
I would need an option for both numerics and strings.
Thank you.
Request clarification before answering.
Hi Matthew,
You can create a parameter and set it to allow multiple values. Change your formula to use the parameter instead of the array.
You can create a formula to display the array like:
NumberVar i;
StringVar myArray;
i := 1;
myArray := "";
While i <= Count ({?My Parameter}) Do
(
myArray := myArray & ToText ({?My Parameter} [i], 0, "") & ", ";
i := i + 1;
);
//Removes the trailing comma
myArray [1 to Length (myArray) - 2];
The Count ({?My Parameter}) is the number of elements in the parameter. So it just loops through all of the numbers in your parameter, converts them to a string and lists them out.
Good luck,
Brian
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
What software package is your vendor providing? They are probably setting the parameter value automatically in their code and you would have to find some way to hook into that mechanism. So, you'll have to go to them to ask this question because we have no way of knowing how they've done this particular task through the SDK and what types of values they've set it up to accept.
If you can't do this through them then I may have another way of doing this:
1. Create a formula that is just a string value. In your example above, it would look like this (note the final comma on the end!):
{@Values}
"200,401,409,410,411,413,420,450,"
2. Create a formula to display this list correctly:
{@ShowValues}
left({@Values}, Length({@Values} - 1)
3. Change the If statement to this:
if InStr({@Values}, {pool_bearbeit.typ}+",") = 0
To update this list, you only have to change it in {@Values}.
-Dell
Message was edited by: Dell Stinnett-Christy
My edit isn't showing up - the if statement should b:
if InStr({@Values}, ToText({pool_bearbeit.typ}, 0, "") + ",") = 0
This will take care of instances where you have numbers "inside" other numbers, such as if you have a value in {pool_bearbeit.typ} of 20. Since "20" is in part of 200 it's data would not be included in the "then" portion of the If statement. Having the comma on the end of the field value when you're searching prevents this.
-Dell
| User | Count |
|---|---|
| 15 | |
| 9 | |
| 6 | |
| 5 | |
| 4 | |
| 4 | |
| 3 | |
| 2 | |
| 2 | |
| 2 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.